From 04ebfaf17cfb4c85e29316937d7d44667ccc049f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 17 Aug 2021 06:08:59 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../admin/integrations_controller_spec.rb | 12 ----------- ...user_activates_mattermost_slash_command_spec.rb | 12 ----------- ...user_activates_mattermost_slash_command_spec.rb | 5 +++++ spec/requests/api/error_tracking_spec.rb | 16 +++++++++++++- .../projects/operations/update_service_spec.rb | 25 ++++++++++++++++++++++ 5 files changed, 45 insertions(+), 25 deletions(-) (limited to 'spec') diff --git a/spec/controllers/admin/integrations_controller_spec.rb b/spec/controllers/admin/integrations_controller_spec.rb index 3d37fe7bf79..64ae2a95b4e 100644 --- a/spec/controllers/admin/integrations_controller_spec.rb +++ b/spec/controllers/admin/integrations_controller_spec.rb @@ -131,18 +131,6 @@ RSpec.describe Admin::IntegrationsController do expect(response).to render_template 'shared/integrations/overrides' expect(assigns(:integration)).to eq(instance_integration) end - - context 'when `instance_level_integration_overrides` is not enabled' do - before do - stub_feature_flags(instance_level_integration_overrides: false) - end - - it 'renders a 404' do - subject - - expect(response).to have_gitlab_http_status(:not_found) - end - end end end end diff --git a/spec/features/admin/integrations/user_activates_mattermost_slash_command_spec.rb b/spec/features/admin/integrations/user_activates_mattermost_slash_command_spec.rb index c4626996d0c..22a27b33671 100644 --- a/spec/features/admin/integrations/user_activates_mattermost_slash_command_spec.rb +++ b/spec/features/admin/integrations/user_activates_mattermost_slash_command_spec.rb @@ -19,16 +19,4 @@ RSpec.describe 'User activates the instance-level Mattermost Slash Command integ expect(page).to have_link('Settings', href: edit_path) expect(page).to have_link('Projects using custom settings', href: overrides_path) end - - context 'when instance_level_integration_overrides is disabled' do - before do - stub_feature_flags(instance_level_integration_overrides: false) - visit_instance_integration('Mattermost slash commands') - end - - it 'does not display the overrides tab' do - expect(page).not_to have_link('Settings', href: edit_path) - expect(page).not_to have_link('Projects using custom settings', href: overrides_path) - end - end end diff --git a/spec/features/groups/integrations/user_activates_mattermost_slash_command_spec.rb b/spec/features/groups/integrations/user_activates_mattermost_slash_command_spec.rb index 7703268af39..02aa418cd73 100644 --- a/spec/features/groups/integrations/user_activates_mattermost_slash_command_spec.rb +++ b/spec/features/groups/integrations/user_activates_mattermost_slash_command_spec.rb @@ -13,4 +13,9 @@ RSpec.describe 'User activates the group-level Mattermost Slash Command integrat let(:edit_path) { edit_group_settings_integration_path(group, :mattermost_slash_commands) } include_examples 'user activates the Mattermost Slash Command integration' + + it 'does not display the overrides tab' do + expect(page).not_to have_link('Settings', href: edit_path) + expect(page).not_to have_link('Projects using custom settings', href: overrides_admin_application_settings_integration_path(:mattermost_slash_commands)) + end end diff --git a/spec/requests/api/error_tracking_spec.rb b/spec/requests/api/error_tracking_spec.rb index 39121af7bc3..ec9a3378acc 100644 --- a/spec/requests/api/error_tracking_spec.rb +++ b/spec/requests/api/error_tracking_spec.rb @@ -17,7 +17,8 @@ RSpec.describe API::ErrorTracking do 'active' => setting.reload.enabled, 'project_name' => setting.project_name, 'sentry_external_url' => setting.sentry_external_url, - 'api_url' => setting.api_url + 'api_url' => setting.api_url, + 'integrated' => setting.integrated ) end end @@ -79,6 +80,19 @@ RSpec.describe API::ErrorTracking do .to eq('active is empty') end end + + context 'with integrated param' do + let(:params) { { active: true, integrated: true } } + + it 'updates the integrated flag' do + expect(setting.integrated).to be_falsey + + make_request + + expect(json_response).to include('integrated' => true) + expect(setting.reload.integrated).to be_truthy + end + end end context 'without a project setting' do diff --git a/spec/services/projects/operations/update_service_spec.rb b/spec/services/projects/operations/update_service_spec.rb index f91f879b772..1d9d5f6e938 100644 --- a/spec/services/projects/operations/update_service_spec.rb +++ b/spec/services/projects/operations/update_service_spec.rb @@ -262,6 +262,31 @@ RSpec.describe Projects::Operations::UpdateService do expect(project.error_tracking_setting.previous_changes.keys) .to contain_exactly('enabled') end + + context 'with integrated attribute' do + let(:params) do + { + error_tracking_setting_attributes: { + enabled: true, + integrated: true + } + } + end + + it 'updates integrated attribute' do + expect { result } + .to change { project.reload.error_tracking_setting.integrated } + .from(false) + .to(true) + end + + it 'only updates enabled and integrated attributes' do + result + + expect(project.error_tracking_setting.previous_changes.keys) + .to contain_exactly('enabled', 'integrated') + end + end end context 'without setting' do -- cgit v1.2.3