Sha256: 917501b6b0b02751dc413b1d431bf07548a14e4c8ff373eb1710dabbff3068d9

Contents?: true

Size: 770 Bytes

Versions: 8

Compression:

Stored size: 770 Bytes

Contents

require 'dry/logic/predicates'

RSpec.describe Dry::Logic::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

8 entries across 8 versions & 1 rubygems

Version Path
dry-logic-0.2.2 spec/unit/predicates/inclusion_spec.rb
dry-logic-0.2.1 spec/unit/predicates/inclusion_spec.rb
dry-logic-0.2.0 spec/unit/predicates/inclusion_spec.rb
dry-logic-0.1.4 spec/unit/predicates/inclusion_spec.rb
dry-logic-0.1.3 spec/unit/predicates/inclusion_spec.rb
dry-logic-0.1.2 spec/unit/predicates/inclusion_spec.rb
dry-logic-0.1.1 spec/unit/predicates/inclusion_spec.rb
dry-logic-0.1.0 spec/unit/predicates/inclusion_spec.rb