diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 18:06:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-24 18:06:34 +0300 |
commit | f1a5755898e865428c923587402fd965b601c4ea (patch) | |
tree | a93aab01a1d3ba0e93c0fbf1450babfe4674f9dc /spec/lib/gitlab/ci/config/entry/rules | |
parent | 1ae627c65192ae1a01fdac253065ef561a9d6b7e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/ci/config/entry/rules')
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/rules/rule_spec.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/lib/gitlab/ci/config/entry/rules/rule_spec.rb b/spec/lib/gitlab/ci/config/entry/rules/rule_spec.rb index 18037a5612c..9d4f7153cd0 100644 --- a/spec/lib/gitlab/ci/config/entry/rules/rule_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/rules/rule_spec.rb @@ -103,6 +103,52 @@ describe Gitlab::Ci::Config::Entry::Rules::Rule do end end + context 'when using a long list as an invalid changes: clause' do + let(:config) { { changes: ['app/'] * 51 } } + + it { is_expected.not_to be_valid } + + it 'returns errors' do + expect(subject.errors).to include(/changes is too long \(maximum is 50 characters\)/) + end + end + + context 'when using a exists: clause' do + let(:config) { { exists: %w[app/ lib/ spec/ other/* paths/**/*.rb] } } + + it { is_expected.to be_valid } + end + + context 'when using a string as an invalid exists: clause' do + let(:config) { { exists: 'a regular string' } } + + it { is_expected.not_to be_valid } + + it 'reports an error about invalid policy' do + expect(subject.errors).to include(/should be an array of strings/) + end + end + + context 'when using a list as an invalid exists: clause' do + let(:config) { { exists: [1, 2] } } + + it { is_expected.not_to be_valid } + + it 'returns errors' do + expect(subject.errors).to include(/exists should be an array of strings/) + end + end + + context 'when using a long list as an invalid exists: clause' do + let(:config) { { exists: ['app/'] * 51 } } + + it { is_expected.not_to be_valid } + + it 'returns errors' do + expect(subject.errors).to include(/exists is too long \(maximum is 50 characters\)/) + end + end + context 'specifying a delayed job' do let(:config) { { if: '$THIS || $THAT', when: 'delayed', start_in: '15 minutes' } } @@ -198,6 +244,12 @@ describe Gitlab::Ci::Config::Entry::Rules::Rule do expect(entry.value).to eq(config) end end + + context 'when using a exists: clause' do + let(:config) { { exists: %w[app/ lib/ spec/ other/* paths/**/*.rb] } } + + it { is_expected.to eq(config) } + end end describe '.default' do |