diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 18:09:16 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 18:09:16 +0000 |
commit | 80e9fdc9682cfbcfb9202a2733605a6a6bd23f05 (patch) | |
tree | 168375ea13d1a1f01d4cbcf6f0513fc9883e9477 /spec/controllers | |
parent | 5372e109c0660e4670aa987568a51082beca1b3c (diff) | |
download | gitlab-ce-80e9fdc9682cfbcfb9202a2733605a6a6bd23f05.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/groups/settings/integrations_controller_spec.rb | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/spec/controllers/groups/settings/integrations_controller_spec.rb b/spec/controllers/groups/settings/integrations_controller_spec.rb index eee65476dab..6df1ad8a383 100644 --- a/spec/controllers/groups/settings/integrations_controller_spec.rb +++ b/spec/controllers/groups/settings/integrations_controller_spec.rb @@ -11,17 +11,40 @@ describe Groups::Settings::IntegrationsController do sign_in(user) end - describe '#edit' do - context 'when group_level_integrations not enabled' do - it 'returns not_found' do - stub_feature_flags(group_level_integrations: { enabled: false, thing: group }) - - get :edit, params: { group_id: group, id: Service.available_services_names.sample } + describe '#index' do + context 'when user is not owner' do + it 'renders not_found' do + get :index, params: { group_id: group } expect(response).to have_gitlab_http_status(:not_found) end end + context 'when user is owner' do + before do + group.add_owner(user) + end + + context 'when group_level_integrations not enabled' do + it 'returns not_found' do + stub_feature_flags(group_level_integrations: { enabled: false, thing: group }) + + get :index, params: { group_id: group } + + expect(response).to have_gitlab_http_status(:not_found) + end + end + + it 'successfully displays the template' do + get :index, params: { group_id: group } + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template(:index) + end + end + end + + describe '#edit' do context 'when user is not owner' do it 'renders not_found' do get :edit, params: { group_id: group, id: Service.available_services_names.sample } @@ -35,6 +58,16 @@ describe Groups::Settings::IntegrationsController do group.add_owner(user) end + context 'when group_level_integrations not enabled' do + it 'returns not_found' do + stub_feature_flags(group_level_integrations: { enabled: false, thing: group }) + + get :edit, params: { group_id: group, id: Service.available_services_names.sample } + + expect(response).to have_gitlab_http_status(:not_found) + end + end + Service.available_services_names.each do |integration_name| context "#{integration_name}" do it 'successfully displays the template' do |