diff options
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 |