Commit b2ab11a9 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extend tests for pipeline status factory

parent d28f5e77
...@@ -5,6 +5,10 @@ describe Gitlab::Ci::Status::Pipeline::Factory do ...@@ -5,6 +5,10 @@ describe Gitlab::Ci::Status::Pipeline::Factory do
described_class.new(pipeline) described_class.new(pipeline)
end end
let(:status) do
subject.fabricate!
end
context 'when pipeline has a core status' do context 'when pipeline has a core status' do
HasStatus::AVAILABLE_STATUSES.each do |core_status| HasStatus::AVAILABLE_STATUSES.each do |core_status|
context "when core status is #{core_status}" do context "when core status is #{core_status}" do
...@@ -13,8 +17,13 @@ describe Gitlab::Ci::Status::Pipeline::Factory do ...@@ -13,8 +17,13 @@ describe Gitlab::Ci::Status::Pipeline::Factory do
end end
it "fabricates a core status #{core_status}" do it "fabricates a core status #{core_status}" do
expect(subject.fabricate!) expect(status).to be_a(
.to be_a Gitlab::Ci::Status.const_get(core_status.capitalize) Gitlab::Ci::Status.const_get(core_status.capitalize))
end
it 'extends core status with common pipeline methods' do
expect(status).to have_details
expect(status.details_path).to include "pipelines/#{pipeline.id}"
end end
end end
end end
...@@ -30,8 +39,12 @@ describe Gitlab::Ci::Status::Pipeline::Factory do ...@@ -30,8 +39,12 @@ describe Gitlab::Ci::Status::Pipeline::Factory do
end end
it 'fabricates extended "success with warnings" status' do it 'fabricates extended "success with warnings" status' do
expect(subject.fabricate!) expect(status)
.to be_a Gitlab::Ci::Status::Pipeline::SuccessWithWarnings .to be_a Gitlab::Ci::Status::Pipeline::SuccessWithWarnings
end end
it 'extends core status with common pipeline methods' do
expect(status).to have_details
end
end end
end end
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