Sha256: 4aaa3f774cfd6178af488c05a0e159cb73d666e7eb4a538542804ccaa5d354ad

Contents?: true

Size: 780 Bytes

Versions: 6

Compression:

Stored size: 780 Bytes

Contents

require 'dry/validation/predicates'

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

    context 'when 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 passing predicate'
    end

    context 'with 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 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/exclusion_spec.rb
dry-validation-0.4.0 spec/unit/predicates/exclusion_spec.rb
dry-validation-0.3.1 spec/unit/predicates/exclusion_spec.rb
dry-validation-0.3.0 spec/unit/predicates/exclusion_spec.rb
dry-validation-0.2.0 spec/unit/predicates/exclusion_spec.rb
dry-validation-0.1.0 spec/unit/predicates/exclusion_spec.rb