Sha256: 70f63a80e7565a7c2a5e175f9e5edd920cc613bc7a51b8d1649f9497c360f7a8

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'dry/logic/predicates'

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

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

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

  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(:attr?) { Dry::Logic::Predicates[:attr?] }

  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.4 spec/shared/predicates.rb