Sha256: d5d9489bf460dca22baded6d65ab8c2f6cb8de4b58968c1b3edc0f8516c34bc8

Contents?: true

Size: 780 Bytes

Versions: 6

Compression:

Stored size: 780 Bytes

Contents

require 'dry/validation/predicates'

RSpec.describe Dry::Validation::Predicates do
  describe '#inclusion?' do
    let(:predicate_name) { :inclusion? }

    context 'when value is present in list' do
      let(:arguments_list) do
        [
          [['Jill', 'John'], 'Jill'],
          [['Jill', 'John'], 'John'],
          [1..2, 1],
          [1..2, 2],
          [[nil, false], nil],
          [[nil, false], false]
        ]
      end

      it_behaves_like 'a passing predicate'
    end

    context 'with value is not present in list' do
      let(:arguments_list) do
        [
          [['Jill', 'John'], 'Jack'],
          [1..2, 0],
          [1..2, 3],
          [[nil, false], true]
        ]
      end

      it_behaves_like 'a failing predicate'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-validation-0.4.1 spec/unit/predicates/inclusion_spec.rb
dry-validation-0.4.0 spec/unit/predicates/inclusion_spec.rb
dry-validation-0.3.1 spec/unit/predicates/inclusion_spec.rb
dry-validation-0.3.0 spec/unit/predicates/inclusion_spec.rb
dry-validation-0.2.0 spec/unit/predicates/inclusion_spec.rb
dry-validation-0.1.0 spec/unit/predicates/inclusion_spec.rb