diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-30 14:47:54 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-08-30 14:47:54 +0200 |
commit | 1bf87d25241eb5e1a0f147d350814a3a1cfa1343 (patch) | |
tree | a24b78a2e514b2064745c4a71acda79710ced7e5 | |
parent | 3474e109b73e0373a2663b5ae06db9aab61e1c02 (diff) | |
download | gitlab-ce-feature/gb/add-complex-jobs-only-except-config-policy.tar.gz |
Remove unused expressions policy from ci/cd configfeature/gb/add-complex-jobs-only-except-config-policy
-rw-r--r-- | lib/gitlab/ci/config/entry/policy.rb | 19 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/policy_spec.rb | 20 |
2 files changed, 0 insertions, 39 deletions
diff --git a/lib/gitlab/ci/config/entry/policy.rb b/lib/gitlab/ci/config/entry/policy.rb index 05602f1b3c6..3cdae1cee4f 100644 --- a/lib/gitlab/ci/config/entry/policy.rb +++ b/lib/gitlab/ci/config/entry/policy.rb @@ -7,7 +7,6 @@ module Gitlab # class Policy < Simplifiable strategy :RefsPolicy, if: -> (config) { config.is_a?(Array) } - strategy :ExpressionsPolicy, if: -> (config) { config.is_a?(Hash) } class RefsPolicy < Entry::Node include Entry::Validatable @@ -17,24 +16,6 @@ module Gitlab end end - class ExpressionsPolicy < Entry::Node - include Entry::Validatable - include Entry::Attributable - - attributes :refs, :expressions - - validations do - validates :config, presence: true - validates :config, allowed_keys: %i[refs expressions] - - with_options allow_nil: true do - validates :refs, array_of_strings_or_regexps: true - validates :expressions, type: Array - validates :expressions, presence: true - end - end - end - class UnknownStrategy < Entry::Node def errors ["#{location} has to be either an array of conditions or a hash"] diff --git a/spec/lib/gitlab/ci/config/entry/policy_spec.rb b/spec/lib/gitlab/ci/config/entry/policy_spec.rb index ccf885969fb..36a84da4a52 100644 --- a/spec/lib/gitlab/ci/config/entry/policy_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/policy_spec.rb @@ -56,26 +56,6 @@ describe Gitlab::Ci::Config::Entry::Policy do end end - context 'when using complex policy' do - context 'when it is an empty hash' do - let(:config) { {} } - - it 'reports an error about configuration not being present' do - expect(entry.errors).to include /can't be blank/ - end - end - - context 'when it contains unknown keys' do - let(:config) { { refs: ['something'], invalid: 'master' } } - - it 'is not valid entry' do - expect(entry).not_to be_valid - expect(entry.errors) - .to include /policy config contains unknown keys: invalid/ - end - end - end - context 'when policy strategy does not match' do let(:config) { 'string strategy' } |