Sha256: 6e919faa8e5c2c54ee9766dfc94db0f486fd69185df47d6699df5a457268ddaa

Contents?: true

Size: 681 Bytes

Versions: 5

Compression:

Stored size: 681 Bytes

Contents

require 'dry/logic/predicates'

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

    context 'when the value matches the pattern' do
      let(:arguments_list) do
        [
          [11, 11],
          [:odd?.to_proc, 11],
          [/\Af/, 'foo'],
          [Integer, 11]
        ]
      end

      it_behaves_like 'a passing predicate'
    end

    context "when the value doesn't match the pattern" do
      let(:arguments_list) do
        [
          [13, 14],
          [:odd?.to_proc, 12],
          [/\Af/, 'bar'],
          [String, 11]
        ]
      end

      it_behaves_like 'a failing predicate'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dry-logic-1.0.0 spec/unit/predicates/case_spec.rb
dry-logic-0.6.1 spec/unit/predicates/case_spec.rb
dry-logic-0.6.0 spec/unit/predicates/case_spec.rb
dry-logic-0.5.0 spec/unit/predicates/case_spec.rb
dry-logic-0.4.2 spec/unit/predicates/case_spec.rb