diff options
Diffstat (limited to 'spec/serializers/ci/pipeline_entity_spec.rb')
-rw-r--r-- | spec/serializers/ci/pipeline_entity_spec.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/serializers/ci/pipeline_entity_spec.rb b/spec/serializers/ci/pipeline_entity_spec.rb index 808dc38f653..ff364918b4f 100644 --- a/spec/serializers/ci/pipeline_entity_spec.rb +++ b/spec/serializers/ci/pipeline_entity_spec.rb @@ -15,12 +15,13 @@ RSpec.describe Ci::PipelineEntity do subject { entity.as_json } context 'when pipeline is empty' do - let(:pipeline) { create(:ci_empty_pipeline) } + let(:pipeline) { create(:ci_empty_pipeline, name: 'Build pipeline') } it 'contains required fields' do expect(subject).to include :id, :iid, :user, :path, :coverage, :source expect(subject).to include :ref, :commit expect(subject).to include :updated_at, :created_at + expect(subject[:name]).to eq('Build pipeline') end it 'excludes coverage data when disabled' do @@ -31,10 +32,15 @@ RSpec.describe Ci::PipelineEntity do end it 'contains details' do + allow(pipeline).to receive(:merge_request_event_type).and_return(:merged_result) + expect(subject).to include :details expect(subject[:details]) - .to include :duration, :finished_at, :name + .to include :duration, :finished_at, :name, :event_type_name expect(subject[:details][:status]).to include :icon, :favicon, :text, :label, :tooltip + + expect(subject[:details][:event_type_name]).to eq('Merged result pipeline') + expect(subject[:details][:name]).to eq('Merged result pipeline') end it 'contains flags' do @@ -43,6 +49,16 @@ RSpec.describe Ci::PipelineEntity do .to include :stuck, :auto_devops, :yaml_errors, :retryable, :cancelable, :merge_request end + + context 'when pipeline_name feature flag is disabled' do + before do + stub_feature_flags(pipeline_name: false) + end + + it 'does not return name' do + is_expected.not_to include(:name) + end + end end context 'when default branch not protected' do |