From b2ab11a91785ffe0316e38687837e165fad3eb65 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Mon, 5 Dec 2016 13:10:20 +0100 Subject: [PATCH] Extend tests for pipeline status factory --- .../gitlab/ci/status/pipeline/factory_spec.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb index 9f251735067..543dae0640d 100644 --- a/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/pipeline/factory_spec.rb @@ -5,6 +5,10 @@ describe Gitlab::Ci::Status::Pipeline::Factory do described_class.new(pipeline) end + let(:status) do + subject.fabricate! + end + context 'when pipeline has a core status' do HasStatus::AVAILABLE_STATUSES.each do |core_status| context "when core status is #{core_status}" do @@ -13,8 +17,13 @@ describe Gitlab::Ci::Status::Pipeline::Factory do end it "fabricates a core status #{core_status}" do - expect(subject.fabricate!) - .to be_a Gitlab::Ci::Status.const_get(core_status.capitalize) + expect(status).to be_a( + 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 @@ -30,8 +39,12 @@ describe Gitlab::Ci::Status::Pipeline::Factory do end it 'fabricates extended "success with warnings" status' do - expect(subject.fabricate!) + expect(status) .to be_a Gitlab::Ci::Status::Pipeline::SuccessWithWarnings end + + it 'extends core status with common pipeline methods' do + expect(status).to have_details + end end end