Sha256: 20d7dd56c2b9f4a3d713e3d2e100745dd662f4d0444208fcbe569ee40198af18

Contents?: true

Size: 986 Bytes

Versions: 1

Compression:

Stored size: 986 Bytes

Contents

require 'dry/logic/predicates'

RSpec.shared_examples 'predicates' do
  let(:none?) { Dry::Logic::Predicates[:none?] }

  let(:str?) { Dry::Logic::Predicates[:str?] }

  let(:int?) { Dry::Logic::Predicates[:int?] }

  let(:filled?) { Dry::Logic::Predicates[:filled?] }

  let(:min_size?) { Dry::Logic::Predicates[:min_size?] }

  let(:lt?) { Dry::Logic::Predicates[:lt?] }

  let(:gt?) { Dry::Logic::Predicates[:gt?] }

  let(:key?) { Dry::Logic::Predicates[:key?] }

  let(:eql?) { Dry::Logic::Predicates[:eql?] }
end

RSpec.shared_examples 'a passing predicate' do
  let(:predicate) { Dry::Logic::Predicates[predicate_name] }

  it do
    arguments_list.each do |(left, right)|
      expect(predicate.call(left, right)).to be(true)
    end
  end
end

RSpec.shared_examples 'a failing predicate' do
  let(:predicate) { Dry::Logic::Predicates[predicate_name] }

  it do
    arguments_list.each do |(left, right)|
      expect(predicate.call(left, right)).to be(false)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry-logic-0.1.0 spec/shared/predicates.rb