summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-10-24 16:20:18 +0300
committerFilipa Lacerda <filipa@gitlab.com>2017-10-24 16:20:18 +0300
commit2fb0697e806a19dc39f8ad3192e64603fc72c412 (patch)
tree14af769d5542c19e0b7ef692fa5992a8bf167528
parentb51c12a4c1524eeb019fbb2960dd566637e16872 (diff)
downloadgitlab-ce-38869-groups-select.tar.gz
Fix broken rspec tests38869-groups-select
-rw-r--r--app/assets/javascripts/groups_select.js8
-rw-r--r--spec/features/projects/members/share_with_group_spec.rb2
2 files changed, 5 insertions, 5 deletions
diff --git a/app/assets/javascripts/groups_select.js b/app/assets/javascripts/groups_select.js
index f7f40b557f3..a69a0bde17b 100644
--- a/app/assets/javascripts/groups_select.js
+++ b/app/assets/javascripts/groups_select.js
@@ -2,7 +2,8 @@ import Api from './api';
import { normalizeCRLFHeaders } from './lib/utils/common_utils';
export default function groupsSelect() {
- const PER_PAGE = 20;
+ // Needs to be accessible in rspec
+ window.GROUP_SELECT_PER_PAGE = 20;
$('.ajax-groups-select').each(function setAjaxGroupsSelect2() {
const $select = $(this);
const allAvailable = $select.data('all-available');
@@ -16,8 +17,7 @@ export default function groupsSelect() {
dataType: 'json',
quietMillis: 250,
transport(params) {
- // eslint-disable-next-line promise/catch-or-return
- $.ajax(params)
+ return $.ajax(params)
.then((data, status, xhr) => {
const results = data || [];
@@ -40,7 +40,7 @@ export default function groupsSelect() {
return {
search,
page,
- per_page: PER_PAGE,
+ per_page: window.GROUP_SELECT_PER_PAGE,
all_available: allAvailable,
};
},
diff --git a/spec/features/projects/members/share_with_group_spec.rb b/spec/features/projects/members/share_with_group_spec.rb
index 3b368f8e25d..63b5df5a8f5 100644
--- a/spec/features/projects/members/share_with_group_spec.rb
+++ b/spec/features/projects/members/share_with_group_spec.rb
@@ -149,7 +149,7 @@ feature 'Project > Members > Share with Group', :js do
create(:group).add_owner(master)
visit project_settings_members_path(project)
- execute_script 'GroupsSelect.PER_PAGE = 1;'
+ execute_script 'GROUP_SELECT_PER_PAGE = 1;'
open_select2 '#link_group_id'
end