Sha256: 2f8fed759a9b40a4052dc3a3bf87010cdb32d76c6ac5b4c05e6b681d68b8766b

Contents?: true

Size: 712 Bytes

Versions: 4

Compression:

Stored size: 712 Bytes

Contents

# frozen_string_literal: true

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

4 entries across 4 versions & 1 rubygems

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