diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-05 18:09:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-05 18:09:05 +0300 |
commit | 2f229658aea96b45edbb28c97a2aa0c58b3433eb (patch) | |
tree | e4b9d68d4d33ed2a48e8188da7ffb551d24af958 /spec | |
parent | 2e32e03fc2aa93d8b6ef8f5b8e0fedc1faaf0ed7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/models/deployment_spec.rb | 8 | ||||
-rw-r--r-- | spec/services/deployments/link_merge_requests_service_spec.rb | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index 49c3c97e7df..aae0cedc079 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -161,9 +161,9 @@ RSpec.describe Deployment do end end - it 'executes Deployments::LinkMergeRequestWorker asynchronously' do + it 'does not execute Deployments::LinkMergeRequestWorker' do expect(Deployments::LinkMergeRequestWorker) - .to receive(:perform_async).with(deployment.id) + .not_to receive(:perform_async).with(deployment.id) deployment.drop! end @@ -188,9 +188,9 @@ RSpec.describe Deployment do end end - it 'executes Deployments::LinkMergeRequestWorker asynchronously' do + it 'does not execute Deployments::LinkMergeRequestWorker' do expect(Deployments::LinkMergeRequestWorker) - .to receive(:perform_async).with(deployment.id) + .not_to receive(:perform_async).with(deployment.id) deployment.cancel! end diff --git a/spec/services/deployments/link_merge_requests_service_spec.rb b/spec/services/deployments/link_merge_requests_service_spec.rb index e2ac2273b8c..a5a13230d6f 100644 --- a/spec/services/deployments/link_merge_requests_service_spec.rb +++ b/spec/services/deployments/link_merge_requests_service_spec.rb @@ -32,6 +32,17 @@ RSpec.describe Deployments::LinkMergeRequestsService do end end + context 'when the deployment failed' do + it 'does nothing' do + environment = create(:environment, name: 'foo') + deploy = create(:deployment, :failed, environment: environment) + + expect(deploy).not_to receive(:link_merge_requests) + + described_class.new(deploy).execute + end + end + context 'when there is a previous deployment' do it 'links all merge requests merged since the previous deployment' do deploy1 = create( |