diff options
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r-- | spec/models/commit_spec.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb index 195e9c1277b..132b77d38b2 100644 --- a/spec/models/commit_spec.rb +++ b/spec/models/commit_spec.rb @@ -213,11 +213,22 @@ eos let(:commit) { project.commit } context 'when the pipeline is available' do - it 'only uses the last pipeline' do - create(:ci_pipeline_without_jobs, project: project, status: 'failed', sha: commit.id) - create(:ci_pipeline_without_jobs, project: project, status: 'success', sha: commit.id) + context 'without ref' do + it 'only uses the last pipeline' do + create(:ci_pipeline_without_jobs, project: project, status: 'failed', sha: commit.id) + create(:ci_pipeline_without_jobs, project: project, status: 'success', sha: commit.id) - expect(commit.status).to eq('success') + expect(commit.status).to eq('failed') + end + end + + context 'with ref' do + it 'only uses the last pipeline' do + create(:ci_pipeline_without_jobs, project: project, status: 'failed', sha: commit.id) + create(:ci_pipeline_without_jobs, project: project, status: 'success', sha: commit.id) + + expect(commit.status('master')).to eq('success') + end end end |