diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-21 15:08:26 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-21 15:08:26 +0000 |
commit | c859c3bfd242288065fe5e2d887f7204f09e2335 (patch) | |
tree | 10febaf8774a3ea6ab3773c0dd97658d673fb280 /spec/workers | |
parent | 28ce39a3e0e7b47e53939a15fb823af9c433327a (diff) | |
download | gitlab-ce-c859c3bfd242288065fe5e2d887f7204f09e2335.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/merge_request_mergeability_check_worker_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/workers/merge_request_mergeability_check_worker_spec.rb b/spec/workers/merge_request_mergeability_check_worker_spec.rb new file mode 100644 index 00000000000..2331664215f --- /dev/null +++ b/spec/workers/merge_request_mergeability_check_worker_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe MergeRequestMergeabilityCheckWorker do + subject { described_class.new } + + describe '#perform' do + context 'when merge request does not exist' do + it 'does not execute MergeabilityCheckService' do + expect(MergeRequests::MergeabilityCheckService).not_to receive(:new) + + subject.perform(1) + end + end + + context 'when merge request exists' do + let(:merge_request) { create(:merge_request) } + + it 'executes MergeabilityCheckService' do + expect_next_instance_of(MergeRequests::MergeabilityCheckService, merge_request) do |service| + expect(service).to receive(:execute).and_return(double(error?: false)) + end + + subject.perform(merge_request.id) + end + end + end +end |