diff options
Diffstat (limited to 'spec/lib/gitlab/ci/yaml_processor_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/yaml_processor_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb index 9dea74f6345..058afddd73f 100644 --- a/spec/lib/gitlab/ci/yaml_processor_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb @@ -1735,6 +1735,39 @@ module Gitlab it { expect { subject }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, 'jobs:test1 dependencies the build2 should be part of needs') } end + + context 'needs with a Hash type and dependencies with a string type that are mismatching' do + let(:needs) do + [ + "build1", + { job: "build2" } + ] + end + let(:dependencies) { %w(build3) } + + it { expect { subject }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, 'jobs:test1 dependencies the build3 should be part of needs') } + end + + context 'needs with an array type and dependency with a string type' do + let(:needs) { %w(build1) } + let(:dependencies) { 'deploy' } + + it { expect { subject }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, 'jobs:test1 dependencies should be an array of strings') } + end + + context 'needs with a string type and dependency with an array type' do + let(:needs) { 'build1' } + let(:dependencies) { %w(deploy) } + + it { expect { subject }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, 'jobs:test1:needs config can only be a hash or an array') } + end + + context 'needs with a Hash type and dependency with a string type' do + let(:needs) { { job: 'build1' } } + let(:dependencies) { 'deploy' } + + it { expect { subject }.to raise_error(Gitlab::Ci::YamlProcessor::ValidationError, 'jobs:test1 dependencies should be an array of strings') } + end end context 'with when/rules conflict' do |