diff options
author | Felipe Artur <felipefac@gmail.com> | 2017-12-01 18:33:24 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2017-12-05 17:54:10 +0300 |
commit | bac143ea63d74a33a73274746d24e6900b84cc6a (patch) | |
tree | 306e07f81e2a26e5cf0687d66e8ddd628b7e3ca9 | |
parent | 5cf3ff27c8f955e701837529d72a070697a41a04 (diff) |
use actual head pipeline on merge request presenter
-rw-r--r-- | spec/models/merge_request_spec.rb | 14 | ||||
-rw-r--r-- | spec/presenters/merge_request_presenter_spec.rb | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index 34fae89b430..e606fb027b5 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -838,6 +838,14 @@ describe MergeRequest do expect(subject.head_pipeline).to be_nil end + + context 'when the source project does not exist' do + it 'returns nil' do + allow(subject).to receive(:source_project).and_return(nil) + + expect(subject.head_pipeline).to be_nil + end + end end describe '#actual_head_pipeline' do @@ -855,6 +863,12 @@ describe MergeRequest do expect(subject.actual_head_pipeline).to eq(subject.head_pipeline) expect(subject.actual_head_pipeline).to eq(pipeline) end + + it 'returns nil when source project does not exist' do + allow(subject).to receive(:source_project).and_return(nil) + + expect(subject.actual_head_pipeline).to be_nil + end end end diff --git a/spec/presenters/merge_request_presenter_spec.rb b/spec/presenters/merge_request_presenter_spec.rb index 5e114434a67..f325d1776e4 100644 --- a/spec/presenters/merge_request_presenter_spec.rb +++ b/spec/presenters/merge_request_presenter_spec.rb @@ -31,7 +31,7 @@ describe MergeRequestPresenter do let(:pipeline) { build_stubbed(:ci_pipeline) } before do - allow(resource).to receive(:head_pipeline).and_return(pipeline) + allow(resource).to receive(:actual_head_pipeline).and_return(pipeline) end context 'success with warnings' do |