diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-16 15:08:41 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-16 15:08:41 +0000 |
commit | d47f9d2304dbc3a23bba7fe7a5cd07218eeb41cd (patch) | |
tree | 4b4efa1ccd8246fba2dc9f8816d9d2c0268e9818 /spec/lib/gitlab/database_importers/self_monitoring/project | |
parent | c158fa8d69c704663d289341a014c44c062cda88 (diff) | |
download | gitlab-ce-d47f9d2304dbc3a23bba7fe7a5cd07218eeb41cd.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/database_importers/self_monitoring/project')
-rw-r--r-- | spec/lib/gitlab/database_importers/self_monitoring/project/delete_service_spec.rb | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/spec/lib/gitlab/database_importers/self_monitoring/project/delete_service_spec.rb b/spec/lib/gitlab/database_importers/self_monitoring/project/delete_service_spec.rb index b0cec61ce06..6446ab1beb4 100644 --- a/spec/lib/gitlab/database_importers/self_monitoring/project/delete_service_spec.rb +++ b/spec/lib/gitlab/database_importers/self_monitoring/project/delete_service_spec.rb @@ -4,12 +4,8 @@ require 'spec_helper' describe Gitlab::DatabaseImporters::SelfMonitoring::Project::DeleteService do describe '#execute' do + let!(:application_setting) { create(:application_setting) } let(:result) { subject.execute } - let(:application_setting) { Gitlab::CurrentSettings.current_application_settings } - - before do - allow(ApplicationSetting).to receive(:current_without_cache) { application_setting } - end context 'when project does not exist' do it 'returns error' do @@ -21,24 +17,16 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::DeleteService do end end - context 'with project destroyed but ID still present in application settings' do - before do - application_setting.instance_administration_project_id = 1 - end - - it 'deletes project ID from application settings' do - subject.execute - - expect(application_setting.instance_administration_project_id).to be_nil - end - end - context 'when self monitoring project exists' do let(:group) { create(:group) } let(:project) { create(:project, namespace: group) } - before do - application_setting.instance_administration_project = project + let(:application_setting) do + create( + :application_setting, + instance_administration_project_id: project.id, + instance_administrators_group_id: group.id + ) end it 'destroys project' do @@ -50,7 +38,13 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::DeleteService do it 'deletes project ID from application settings' do subject.execute - expect(application_setting.instance_administration_project_id).to be_nil + expect(application_setting.reload.instance_administration_project_id).to be_nil + end + + it 'does not delete group' do + subject.execute + + expect(application_setting.instance_administrators_group).to eq(group) end end end |