Test against MergeRequest#all_commits_sha, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6414#note_15750344 So that we could just use it in testing for MergeRequest#all_pipelines
This commit is contained in:
parent
f2eb10c9bc
commit
55de6e15d3
|
@ -496,20 +496,18 @@ describe MergeRequest, models: true do
|
|||
|
||||
describe '#all_pipelines' do
|
||||
shared_examples 'returning pipelines with proper ordering' do
|
||||
let!(:pipelines) do
|
||||
subject.merge_request_diffs.flat_map do |diff|
|
||||
diff.commits.map do |commit|
|
||||
create(:ci_empty_pipeline,
|
||||
project: subject.source_project,
|
||||
sha: commit.id,
|
||||
ref: subject.source_branch)
|
||||
end
|
||||
let!(:all_pipelines) do
|
||||
subject.all_commits_sha.map do |sha|
|
||||
create(:ci_empty_pipeline,
|
||||
project: subject.source_project,
|
||||
sha: sha,
|
||||
ref: subject.source_branch)
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns all pipelines' do
|
||||
expect(subject.all_pipelines).not_to be_empty
|
||||
expect(subject.all_pipelines).to eq(pipelines.reverse)
|
||||
expect(subject.all_pipelines).to eq(all_pipelines.reverse)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -526,6 +524,21 @@ describe MergeRequest, models: true do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#all_commits_sha' do
|
||||
let(:all_commits_sha) do
|
||||
subject.merge_request_diffs.flat_map(&:commits).map(&:sha).uniq
|
||||
end
|
||||
|
||||
before do
|
||||
subject.update(target_branch: 'markdown')
|
||||
end
|
||||
|
||||
it 'returns all SHA from all merge_request_diffs' do
|
||||
expect(subject.merge_request_diffs.size).to eq(2)
|
||||
expect(subject.all_commits_sha).to eq(all_commits_sha)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#participants' do
|
||||
let(:project) { create(:project, :public) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue