diff options
Diffstat (limited to 'spec/lib/api/validations/validators/project_portable_spec.rb')
-rw-r--r-- | spec/lib/api/validations/validators/project_portable_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/lib/api/validations/validators/project_portable_spec.rb b/spec/lib/api/validations/validators/project_portable_spec.rb new file mode 100644 index 00000000000..8c1a49d5214 --- /dev/null +++ b/spec/lib/api/validations/validators/project_portable_spec.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe API::Validations::Validators::ProjectPortable do + include ApiValidatorsHelpers + + let(:portable) { 'labels' } + let(:not_portable) { 'project_members' } + + subject do + described_class.new(['test'], {}, false, scope.new) + end + + context 'valid portable' do + it 'does not raise a validation error' do + expect_no_validation_error('test' => portable) + end + end + + context 'empty params' do + it 'raises a validation error' do + expect_validation_error('test' => nil) + expect_validation_error('test' => '') + end + end + + context 'not portable' do + it 'raises a validation error' do + expect_validation_error('test' => not_portable) # Sha length > 40 + end + end +end |