diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 12:09:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 12:09:43 +0300 |
commit | f5050253469fc0961c02deec0e698ad62bdd9de5 (patch) | |
tree | 30bbd8f8b556fd5b730f0123921138ee1d6bdaa2 /spec/services | |
parent | f6cdec670b9b757fc2225a2c6627ab79765e5b8a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
3 files changed, 11 insertions, 16 deletions
diff --git a/spec/services/ci/expire_pipeline_cache_service_spec.rb b/spec/services/ci/expire_pipeline_cache_service_spec.rb index 7b9d6ed4f41..78e1ba0109a 100644 --- a/spec/services/ci/expire_pipeline_cache_service_spec.rb +++ b/spec/services/ci/expire_pipeline_cache_service_spec.rb @@ -22,19 +22,19 @@ describe Ci::ExpirePipelineCacheService do end it 'invalidates Etag caching for merge request pipelines if pipeline runs on any commit of that source branch' do - pipeline = create(:ci_empty_pipeline, status: 'created', project: project, ref: 'master') - merge_request = create(:merge_request, source_project: project, source_branch: pipeline.ref) + merge_request = create(:merge_request, :with_detached_merge_request_pipeline) + project = merge_request.target_project + merge_request_pipelines_path = "/#{project.full_path}/-/merge_requests/#{merge_request.iid}/pipelines.json" allow_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch) expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(merge_request_pipelines_path) - subject.execute(pipeline) + subject.execute(merge_request.all_pipelines.last) end it 'updates the cached status for a project' do - expect(Gitlab::Cache::Ci::ProjectPipelineStatus).to receive(:update_for_pipeline) - .with(pipeline) + expect(Gitlab::Cache::Ci::ProjectPipelineStatus).to receive(:update_for_pipeline).with(pipeline) subject.execute(pipeline) end diff --git a/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb b/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb index 4d87fa3e832..0cec1e7be22 100644 --- a/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb +++ b/spec/services/merge_requests/add_todo_when_build_fails_service_spec.rb @@ -8,10 +8,6 @@ describe MergeRequests::AddTodoWhenBuildFailsService do let(:sha) { '1234567890abcdef1234567890abcdef12345678' } let(:ref) { merge_request.source_branch } - let(:pipeline) do - create(:ci_pipeline, ref: ref, project: project, sha: sha) - end - let(:service) do described_class.new(project, user, commit_message: 'Awesome message') end @@ -19,12 +15,11 @@ describe MergeRequests::AddTodoWhenBuildFailsService do let(:todo_service) { spy('todo service') } let(:merge_request) do - create(:merge_request, merge_user: user, - source_branch: 'master', - target_branch: 'feature', - source_project: project, - target_project: project, - state: 'opened') + create(:merge_request, :with_detached_merge_request_pipeline, :opened, merge_user: user) + end + + let(:pipeline) do + merge_request.all_pipelines.take end before do diff --git a/spec/services/users/destroy_service_spec.rb b/spec/services/users/destroy_service_spec.rb index a664719783a..216d9170274 100644 --- a/spec/services/users/destroy_service_spec.rb +++ b/spec/services/users/destroy_service_spec.rb @@ -15,7 +15,7 @@ describe Users::DestroyService do it 'deletes the user' do user_data = service.execute(user) - expect { user_data['email'].to eq(user.email) } + expect(user_data['email']).to eq(user.email) expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound) expect { Namespace.find(namespace.id) }.to raise_error(ActiveRecord::RecordNotFound) end |