diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/serializers/ci/dag_pipeline_entity_spec.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/serializers/ci/dag_pipeline_entity_spec.rb')
-rw-r--r-- | spec/serializers/ci/dag_pipeline_entity_spec.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/serializers/ci/dag_pipeline_entity_spec.rb b/spec/serializers/ci/dag_pipeline_entity_spec.rb index fab8798effc..e1703b09f97 100644 --- a/spec/serializers/ci/dag_pipeline_entity_spec.rb +++ b/spec/serializers/ci/dag_pipeline_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::DagPipelineEntity do +RSpec.describe Ci::DagPipelineEntity do let_it_be(:request) { double(:request) } let(:pipeline) { create(:ci_pipeline) } @@ -11,12 +11,20 @@ describe Ci::DagPipelineEntity do describe '#as_json' do subject { entity.as_json } + RSpec.shared_examples "matches schema" do + it 'matches schema' do + expect(subject.to_json).to match_schema('entities/dag_pipeline') + end + end + context 'when pipeline is empty' do it 'contains stages' do expect(subject).to include(:stages) expect(subject[:stages]).to be_empty end + + it_behaves_like "matches schema" end context 'when pipeline has jobs' do @@ -30,6 +38,8 @@ describe Ci::DagPipelineEntity do expect(stages.size).to eq 3 expect(stages.map { |s| s[:name] }).to contain_exactly('build', 'test', 'deploy') end + + it_behaves_like "matches schema" end context 'when pipeline has parallel jobs, DAG needs and GenericCommitStatus' do @@ -138,6 +148,8 @@ describe Ci::DagPipelineEntity do expect(subject.fetch(:stages)[2].fetch(:name)).to eq 'deploy' expect(subject.fetch(:stages)[2]).to eq expected_result.fetch(:stages)[2] end + + it_behaves_like "matches schema" end end end |