summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-12-26 14:33:08 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-12-26 14:35:12 +0800
commite60bf0d6c895bd16919bf22da0829055845574e4 (patch)
treeed605f8aa3c01abdaf1473cc143cdbad1def78d8 /spec/models
parent655289dd337588ad55f41a156cdc2ac318227979 (diff)
downloadgitlab-ce-e60bf0d6c895bd16919bf22da0829055845574e4.tar.gz
Add a test for latest_successful_forfix-latest-pipeine-ordering-again
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/ci/pipeline_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb
index dc377d15f15..cebaa157ef3 100644
--- a/spec/models/ci/pipeline_spec.rb
+++ b/spec/models/ci/pipeline_spec.rb
@@ -464,6 +464,19 @@ describe Ci::Pipeline, models: true do
end
end
+ describe '.latest_successful_for' do
+ include_context 'with some outdated pipelines'
+
+ let!(:latest_successful_pipeline) do
+ create_pipeline(:success, 'ref', 'D')
+ end
+
+ it 'returns the latest successful pipeline' do
+ expect(described_class.latest_successful_for('ref')).
+ to eq(latest_successful_pipeline)
+ end
+ end
+
describe '#status' do
let!(:build) { create(:ci_build, :created, pipeline: pipeline, name: 'test') }