diff options
author | Igor <idrozdov@gitlab.com> | 2019-03-08 02:55:45 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-03-08 02:55:45 +0300 |
commit | 9745d0de2ff605a03e7fbb95d0f71279bbd4afa5 (patch) | |
tree | 0d7f0f89b51199bf676988888539338086f419a3 /spec/lib/api | |
parent | 90f4b6563d42ff7412de277682c0ecb7c25e41bb (diff) |
Provide EE backports for filtering by approver feature
Adds custom validator for ArrayNoneAny param
Extracts some logic in js into separate files
Diffstat (limited to 'spec/lib/api')
-rw-r--r-- | spec/lib/api/helpers/custom_validators_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/api/helpers/custom_validators_spec.rb b/spec/lib/api/helpers/custom_validators_spec.rb index 41e6fb47b11..9945d598a14 100644 --- a/spec/lib/api/helpers/custom_validators_spec.rb +++ b/spec/lib/api/helpers/custom_validators_spec.rb @@ -50,6 +50,29 @@ describe API::Helpers::CustomValidators do end end + describe API::Helpers::CustomValidators::ArrayNoneAny do + subject do + described_class.new(['test'], {}, false, scope.new) + end + + context 'valid parameters' do + it 'does not raise a validation error' do + expect_no_validation_error({ 'test' => [] }) + expect_no_validation_error({ 'test' => [1, 2, 3] }) + expect_no_validation_error({ 'test' => 'None' }) + expect_no_validation_error({ 'test' => 'Any' }) + expect_no_validation_error({ 'test' => 'none' }) + expect_no_validation_error({ 'test' => 'any' }) + end + end + + context 'invalid parameters' do + it 'should raise a validation error' do + expect_validation_error({ 'test' => 'some_other_string' }) + end + end + end + def expect_no_validation_error(params) expect { validate_test_param!(params) }.not_to raise_error end |