summaryrefslogtreecommitdiff
path: root/spec/models/commit_spec.rb
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-11-07 23:44:11 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-11-08 00:04:18 +0800
commit18a71c47603d703de73c46fef4889887f685bebe (patch)
tree591a9bbe4fc7f1adcae5e26b52a1ef625ee6e016 /spec/models/commit_spec.rb
parent7ce03197d33e1194bed49fbd9ac7778f72d6fada (diff)
downloadgitlab-ce-18a71c47603d703de73c46fef4889887f685bebe.tar.gz
Show commit status from latest pipeline
Rather than compound status from all pipelines. Closes #20560
Diffstat (limited to 'spec/models/commit_spec.rb')
-rw-r--r--spec/models/commit_spec.rb27
1 files changed, 11 insertions, 16 deletions
diff --git a/spec/models/commit_spec.rb b/spec/models/commit_spec.rb
index e3bb3482d67..ca277601970 100644
--- a/spec/models/commit_spec.rb
+++ b/spec/models/commit_spec.rb
@@ -206,23 +206,18 @@ eos
end
describe '#status' do
- context 'without arguments for compound status' do
- shared_examples 'giving the status from pipeline' do
- it do
- expect(commit.status).to eq(Ci::Pipeline.status)
- end
- end
-
- context 'with pipelines' do
- let!(:pipeline) do
- create(:ci_empty_pipeline, project: project, sha: commit.sha)
+ context 'without arguments' do
+ before do
+ 5.times do
+ create(:ci_empty_pipeline,
+ project: project,
+ sha: commit.sha,
+ status: Ci::Pipeline.all_state_names.sample)
end
-
- it_behaves_like 'giving the status from pipeline'
end
- context 'without pipelines' do
- it_behaves_like 'giving the status from pipeline'
+ it 'gives the status from latest pipeline' do
+ expect(commit.status).to eq(Ci::Pipeline.latest.first.status)
end
end
@@ -248,8 +243,8 @@ eos
expect(commit.status('fix')).to eq(pipeline_from_fix.status)
end
- it 'gives compound status if ref is nil' do
- expect(commit.status(nil)).to eq(commit.status)
+ it 'gives status from latest pipeline for whatever branch' do
+ expect(commit.status(nil)).to eq(Ci::Pipeline.latest.first.status)
end
end
end