Commit bac143ea authored by Felipe Artur's avatar Felipe Artur

use actual head pipeline on merge request presenter

parent 5cf3ff27
...@@ -838,6 +838,14 @@ describe MergeRequest do ...@@ -838,6 +838,14 @@ describe MergeRequest do
expect(subject.head_pipeline).to be_nil expect(subject.head_pipeline).to be_nil
end 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 end
describe '#actual_head_pipeline' do describe '#actual_head_pipeline' do
...@@ -855,6 +863,12 @@ describe MergeRequest 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(subject.head_pipeline)
expect(subject.actual_head_pipeline).to eq(pipeline) expect(subject.actual_head_pipeline).to eq(pipeline)
end 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
end end
......
...@@ -31,7 +31,7 @@ describe MergeRequestPresenter do ...@@ -31,7 +31,7 @@ describe MergeRequestPresenter do
let(:pipeline) { build_stubbed(:ci_pipeline) } let(:pipeline) { build_stubbed(:ci_pipeline) }
before do before do
allow(resource).to receive(:head_pipeline).and_return(pipeline) allow(resource).to receive(:actual_head_pipeline).and_return(pipeline)
end end
context 'success with warnings' do context 'success with warnings' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment