diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-12-12 00:00:11 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-12-13 18:36:52 +0300 |
commit | 504f77b43a92362b07899e946855dc689b45b3ae (patch) | |
tree | ad394ad0c53b3b3283a375a16e8097b543543f72 /spec/models/merge_request_spec.rb | |
parent | 0cdc840b7fd710e58130a06e94d508c7c8cb133b (diff) |
Prevent worker that updates merge requests head pipeline from failing jobs
Diffstat (limited to 'spec/models/merge_request_spec.rb')
-rw-r--r-- | spec/models/merge_request_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 30a5a3bbff7..0603fc37715 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -1855,4 +1855,20 @@ describe MergeRequest do it_behaves_like 'throttled touch' do subject { create(:merge_request, updated_at: 1.hour.ago) } end + + context 'state machine transitions' do + describe '#unlock_mr' do + subject { create(:merge_request, state: 'locked', merge_jid: 123) } + + it 'updates merge request head pipeline and sets merge_jid to nil' do + pipeline = create(:ci_empty_pipeline, project: subject.project, ref: subject.source_branch, sha: subject.source_branch_sha) + + subject.unlock_mr + + subject.reload + expect(subject.head_pipeline).to eq(pipeline) + expect(subject.merge_jid).to be_nil + end + end + end end |