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

Add a test for latest_successful_for

parent 655289dd
---
title: Fix finding the latest pipeline
merge_request: 8301
author:
......@@ -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') }
......
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