Welcome to mirror list, hosted at ThFree Co, Russian Federation.

integer_none_any_spec.rb « validators « validations « api « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a42f69fd96e7f591c5d9b325031b6e022e04bcfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

require 'spec_helper'

describe API::Validations::Validators::IntegerNoneAny do
  include ApiValidatorsHelpers

  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' => 2)
      expect_no_validation_error('test' => 100)
      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 'raises a validation error' do
      expect_validation_error({ 'test' => 'some_other_string' })
    end
  end
end