Commit a14d6a9e authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add a test for non-persisted merge request

parent 3ae99b2c
...@@ -522,6 +522,28 @@ describe MergeRequest, models: true do ...@@ -522,6 +522,28 @@ describe MergeRequest, models: true do
it_behaves_like 'returning pipelines with proper ordering' it_behaves_like 'returning pipelines with proper ordering'
end end
context 'with unsaved merge request' do
let(:project) { create(:project) }
subject do
MergeRequest.new(source_project: project,
target_project: project,
source_branch: 'master',
target_branch: 'feature')
end
let!(:pipeline) do
create(:ci_empty_pipeline,
project: project,
sha: subject.diff_head_sha,
ref: subject.source_branch)
end
it 'returns pipelines from diff_head_sha' do
expect(subject.all_pipelines).to contain_exactly(pipeline)
end
end
end end
describe '#all_commits_sha' do describe '#all_commits_sha' 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