diff options
author | Stan Hu <stanhu@gmail.com> | 2017-08-08 01:47:48 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-08-08 01:47:48 +0000 |
commit | fd40bce9ccad94c3f8fe522a51a771335d95539f (patch) | |
tree | 0fb76c147480326f17fb77271628c24794255572 /spec/models | |
parent | 4490af8cf22416f12c8cf2e00f8b7c293be08167 (diff) | |
parent | a0c22d1edafbd87d59dbf01acd610da97ec87912 (diff) | |
download | gitlab-ce-fd40bce9ccad94c3f8fe522a51a771335d95539f.tar.gz |
Merge branch '31207-clean-locked-merge-requests' into 'master'
Resolve "Store MergeWorker JID on merge request, and clean up stuck merges"
Closes #31207
See merge request !13207
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/merge_request_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 3402c260f27..a1a3e70a7d2 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -1369,6 +1369,32 @@ describe MergeRequest do end end + describe '#merge_ongoing?' do + it 'returns true when merge process is ongoing for merge_jid' do + merge_request = create(:merge_request, merge_jid: 'foo') + + allow(Gitlab::SidekiqStatus).to receive(:num_running).with(['foo']).and_return(1) + + expect(merge_request.merge_ongoing?).to be(true) + end + + it 'returns false when no merge process running for merge_jid' do + merge_request = build(:merge_request, merge_jid: 'foo') + + allow(Gitlab::SidekiqStatus).to receive(:num_running).with(['foo']).and_return(0) + + expect(merge_request.merge_ongoing?).to be(false) + end + + it 'returns false when merge_jid is nil' do + merge_request = build(:merge_request, merge_jid: nil) + + expect(Gitlab::SidekiqStatus).not_to receive(:num_running) + + expect(merge_request.merge_ongoing?).to be(false) + end + end + describe "#closed_without_fork?" do let(:project) { create(:project) } let(:fork_project) { create(:project, forked_from_project: project) } |