summaryrefslogtreecommitdiff
path: root/spec/controllers/groups_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/groups_controller_spec.rb')
-rw-r--r--spec/controllers/groups_controller_spec.rb68
1 files changed, 25 insertions, 43 deletions
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb
index be30011905c..4a74eff90dc 100644
--- a/spec/controllers/groups_controller_spec.rb
+++ b/spec/controllers/groups_controller_spec.rb
@@ -18,6 +18,7 @@ RSpec.describe GroupsController, factory_default: :keep do
let_it_be(:guest) { group.add_guest(create(:user)).user }
before do
+ stub_feature_flags(vue_issues_list: true)
enable_admin_mode!(admin_with_admin_mode)
end
@@ -71,6 +72,17 @@ RSpec.describe GroupsController, factory_default: :keep do
context 'when the group is not importing' do
it_behaves_like 'details view'
+
+ it 'tracks page views', :snowplow do
+ subject
+
+ expect_snowplow_event(
+ category: 'group_overview',
+ action: 'render',
+ user: user,
+ namespace: group
+ )
+ end
end
context 'when the group is importing' do
@@ -81,6 +93,17 @@ RSpec.describe GroupsController, factory_default: :keep do
it 'redirects to the import status page' do
expect(subject).to redirect_to group_import_path(group)
end
+
+ it 'does not track page views', :snowplow do
+ subject
+
+ expect_no_snowplow_event(
+ category: 'group_overview',
+ action: 'render',
+ user: user,
+ namespace: group
+ )
+ end
end
end
@@ -466,53 +489,12 @@ RSpec.describe GroupsController, factory_default: :keep do
end
end
- describe 'GET #issues', :sidekiq_might_not_need_inline do
- let_it_be(:issue_1) { create(:issue, project: project, title: 'foo') }
- let_it_be(:issue_2) { create(:issue, project: project, title: 'bar') }
-
+ describe 'GET #issues' do
before do
- create_list(:award_emoji, 3, awardable: issue_2)
- create_list(:award_emoji, 2, awardable: issue_1)
- create_list(:award_emoji, 2, :downvote, awardable: issue_2)
-
sign_in(user)
end
- context 'sorting by votes' do
- it 'sorts most popular issues' do
- get :issues, params: { id: group.to_param, sort: 'upvotes_desc' }
- expect(assigns(:issues)).to eq [issue_2, issue_1]
- end
-
- it 'sorts least popular issues' do
- get :issues, params: { id: group.to_param, sort: 'downvotes_desc' }
- expect(assigns(:issues)).to eq [issue_2, issue_1]
- end
- end
-
- context 'searching' do
- it 'works with popularity sort' do
- get :issues, params: { id: group.to_param, search: 'foo', sort: 'popularity' }
-
- expect(assigns(:issues)).to eq([issue_1])
- end
-
- it 'works with priority sort' do
- get :issues, params: { id: group.to_param, search: 'foo', sort: 'priority' }
-
- expect(assigns(:issues)).to eq([issue_1])
- end
-
- it 'works with label priority sort' do
- get :issues, params: { id: group.to_param, search: 'foo', sort: 'label_priority' }
-
- expect(assigns(:issues)).to eq([issue_1])
- end
- end
-
it 'saves the sort order to user preferences' do
- stub_feature_flags(vue_issues_list: true)
-
get :issues, params: { id: group.to_param, sort: 'priority' }
expect(user.reload.user_preference.issues_sort).to eq('priority')
@@ -765,7 +747,7 @@ RSpec.describe GroupsController, factory_default: :keep do
end
it 'does not update the attribute' do
- expect { subject }.not_to change { group.namespace_settings.reload.prevent_sharing_groups_outside_hierarchy }
+ expect { subject }.not_to change { group.reload.prevent_sharing_groups_outside_hierarchy }
expect(response).to have_gitlab_http_status(:not_found)
end