Sha256: 1400cbd241d8449e0b78aa46049167a8787eba8c4be5803cd176336a198f4409

Contents?: true

Size: 809 Bytes

Versions: 4

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true

require 'dry/logic/predicates'

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

    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

4 entries across 4 versions & 1 rubygems

Version Path
dry-logic-1.0.5 spec/unit/predicates/excluded_from_spec.rb
dry-logic-1.0.4 spec/unit/predicates/excluded_from_spec.rb
dry-logic-1.0.3 spec/unit/predicates/excluded_from_spec.rb
dry-logic-1.0.2 spec/unit/predicates/excluded_from_spec.rb