diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-11 21:08:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-11 21:08:58 +0300 |
commit | 1ca9950d5f890cd8f185e1eda158b969a7244fe2 (patch) | |
tree | 6f62715938a4b2b001705c51c697609a8e0850ae /spec/services/projects | |
parent | bcc77054ee9aefd1e332e04a4189390fd5a3112e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/projects')
-rw-r--r-- | spec/services/projects/create_service_spec.rb | 14 | ||||
-rw-r--r-- | spec/services/projects/propagate_service_template_spec.rb (renamed from spec/services/projects/propagate_instance_level_service_spec.rb) | 36 |
2 files changed, 25 insertions, 25 deletions
diff --git a/spec/services/projects/create_service_spec.rb b/spec/services/projects/create_service_spec.rb index 9d23556efda..a8e7919dc81 100644 --- a/spec/services/projects/create_service_spec.rb +++ b/spec/services/projects/create_service_spec.rb @@ -15,7 +15,7 @@ describe Projects::CreateService, '#execute' do } end - it 'creates labels on Project creation if there are instance level services' do + it 'creates labels on Project creation if there are templates' do Label.create(title: "bug", template: true) project = create_project(user, opts) @@ -96,7 +96,7 @@ describe Projects::CreateService, '#execute' do end it 'sets invalid service as inactive' do - create(:service, type: 'JiraService', project: nil, instance: true, active: true) + create(:service, type: 'JiraService', project: nil, template: true, active: true) project = create_project(user, opts) service = project.services.first @@ -342,22 +342,22 @@ describe Projects::CreateService, '#execute' do end end - context 'when there is an active instance level service' do + context 'when there is an active service template' do before do - create(:service, project: nil, instance: true, active: true) + create(:service, project: nil, template: true, active: true) end - it 'creates a service from instance level service' do + it 'creates a service from this template' do project = create_project(user, opts) expect(project.services.count).to eq 1 end end - context 'when a bad instance level service is created' do + context 'when a bad service template is created' do it 'sets service to be inactive' do opts[:import_url] = 'http://www.gitlab.com/gitlab-org/gitlab-foss' - create(:service, type: 'DroneCiService', project: nil, instance: true, active: true) + create(:service, type: 'DroneCiService', project: nil, template: true, active: true) project = create_project(user, opts) service = project.services.first diff --git a/spec/services/projects/propagate_instance_level_service_spec.rb b/spec/services/projects/propagate_service_template_spec.rb index a842842a010..2c3effec617 100644 --- a/spec/services/projects/propagate_instance_level_service_spec.rb +++ b/spec/services/projects/propagate_service_template_spec.rb @@ -2,11 +2,11 @@ require 'spec_helper' -describe Projects::PropagateInstanceLevelService do +describe Projects::PropagateServiceTemplate do describe '.propagate' do - let!(:instance_level_integration) do + let!(:service_template) do PushoverService.create( - instance: true, + template: true, active: true, properties: { device: 'MyDevice', @@ -22,14 +22,14 @@ describe Projects::PropagateInstanceLevelService do it 'creates services for projects' do expect(project.pushover_service).to be_nil - described_class.propagate(instance_level_integration) + described_class.propagate(service_template) expect(project.reload.pushover_service).to be_present end it 'creates services for a project that has another service' do BambooService.create( - instance: true, + template: true, active: true, project: project, properties: { @@ -42,14 +42,14 @@ describe Projects::PropagateInstanceLevelService do expect(project.pushover_service).to be_nil - described_class.propagate(instance_level_integration) + described_class.propagate(service_template) expect(project.reload.pushover_service).to be_present end it 'does not create the service if it exists already' do other_service = BambooService.create( - instance: true, + template: true, active: true, properties: { bamboo_url: 'http://gitlab.com', @@ -59,17 +59,17 @@ describe Projects::PropagateInstanceLevelService do } ) - Service.build_from_instance(project.id, instance_level_integration).save! - Service.build_from_instance(project.id, other_service).save! + Service.build_from_template(project.id, service_template).save! + Service.build_from_template(project.id, other_service).save! - expect { described_class.propagate(instance_level_integration) } + expect { described_class.propagate(service_template) } .not_to change { Service.count } end - it 'creates the service containing the instance attributes' do - described_class.propagate(instance_level_integration) + it 'creates the service containing the template attributes' do + described_class.propagate(service_template) - expect(project.pushover_service.properties).to eq(instance_level_integration.properties) + expect(project.pushover_service.properties).to eq(service_template.properties) end describe 'bulk update', :use_sql_query_cache do @@ -80,7 +80,7 @@ describe Projects::PropagateInstanceLevelService do project_total.times { create(:project) } - described_class.propagate(instance_level_integration) + described_class.propagate(service_template) end it 'creates services for all projects' do @@ -90,18 +90,18 @@ describe Projects::PropagateInstanceLevelService do describe 'external tracker' do it 'updates the project external tracker' do - instance_level_integration.update!(category: 'issue_tracker', default: false) + service_template.update!(category: 'issue_tracker', default: false) - expect { described_class.propagate(instance_level_integration) } + expect { described_class.propagate(service_template) } .to change { project.reload.has_external_issue_tracker }.to(true) end end describe 'external wiki' do it 'updates the project external tracker' do - instance_level_integration.update!(type: 'ExternalWikiService') + service_template.update!(type: 'ExternalWikiService') - expect { described_class.propagate(instance_level_integration) } + expect { described_class.propagate(service_template) } .to change { project.reload.has_external_wiki }.to(true) end end |