diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-20 21:38:24 +0300 |
commit | 983a0bba5d2a042c4a3bbb22432ec192c7501d82 (patch) | |
tree | b153cd387c14ba23bd5a07514c7c01fddf6a78a0 /spec/lib/api/validations/validators/limit_spec.rb | |
parent | a2bddee2cdb38673df0e004d5b32d9f77797de64 (diff) |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/lib/api/validations/validators/limit_spec.rb')
-rw-r--r-- | spec/lib/api/validations/validators/limit_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/lib/api/validations/validators/limit_spec.rb b/spec/lib/api/validations/validators/limit_spec.rb new file mode 100644 index 00000000000..600f74e1fb2 --- /dev/null +++ b/spec/lib/api/validations/validators/limit_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe API::Validations::Validators::Limit do + include ApiValidatorsHelpers + + subject do + described_class.new(['test'], 255, false, scope.new) + end + + context 'valid limit param' do + it 'does not raise a validation error' do + expect_no_validation_error('test' => '123-456') + expect_no_validation_error('test' => '00000000-ffff-0000-ffff-000000000000') + expect_no_validation_error('test' => "#{'a' * 255}") + end + end + + context 'longer than limit param' do + it 'raises a validation error' do + expect_validation_error('test' => "#{'a' * 256}") + end + end +end |