Sha256: ae5300dd3a4b02e0430f5182ea2782e8aec827463e9cc48f57e7d91d21946e14

Contents?: true

Size: 486 Bytes

Versions: 8

Compression:

Stored size: 486 Bytes

Contents

module Bogus
  class VerifiesContracts
    extend Takes

    takes :doubled_interactions, :real_interactions

    def verify(fake_name)
      missed = doubled_interactions.for_fake(fake_name).reject do |interaction|
        real_interactions.recorded?(fake_name, interaction)
      end

      unless missed.empty?
        actual = real_interactions.for_fake(fake_name)
        raise Bogus::ContractNotFulfilled.new(fake_name, missed: missed, actual: actual)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bogus-0.1.7 lib/bogus/contracts/verifies_contracts.rb
bogus-0.1.6 lib/bogus/contracts/verifies_contracts.rb
bogus-0.1.5 lib/bogus/contracts/verifies_contracts.rb
bogus-0.1.4 lib/bogus/contracts/verifies_contracts.rb
bogus-0.1.3 lib/bogus/verifies_contracts.rb
bogus-0.1.2 lib/bogus/verifies_contracts.rb
bogus-0.1.1 lib/bogus/verifies_contracts.rb
bogus-0.1.0 lib/bogus/verifies_contracts.rb