diff options
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/job_spec.rb')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/job_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb index 75ac2ca87ab..acf60a6cdda 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -317,6 +317,26 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do end end + context 'when the `when` keyword is not a string' do + context 'when it is an array' do + let(:config) { { script: 'exit 0', when: ['always'] } } + + it 'returns error' do + expect(entry).not_to be_valid + expect(entry.errors).to include 'job when should be a string' + end + end + + context 'when it is a boolean' do + let(:config) { { script: 'exit 0', when: true } } + + it 'returns error' do + expect(entry).not_to be_valid + expect(entry.errors).to include 'job when should be a string' + end + end + end + context 'when only: is used with rules:' do let(:config) { { only: ['merge_requests'], rules: [{ if: '$THIS' }] } } @@ -653,7 +673,7 @@ RSpec.describe Gitlab::Ci::Config::Entry::Job do with_them do let(:config) { { script: 'ls', rules: rules, only: only }.compact } - it "#{name}" do + it name.to_s do expect(workflow).to receive(:has_rules?) { has_workflow_rules? } entry.compose!(deps) |