class Contractinator::ContractHelpers::FulfillmentAdapter

Public Class Methods

new(context, object, method, args) click to toggle source
# File lib/contractinator/contract_helpers.rb, line 89
def initialize(context, object, method, args)
  @object = object
  @context = context
  @method = method
  @args = args
end

Public Instance Methods

will(matcher) click to toggle source
# File lib/contractinator/contract_helpers.rb, line 96
def will(matcher)
  @context.expect(@object.send(@method, *@args)).to(matcher)
  if matcher.is_a?(RSpec::Matchers::BuiltIn::BeAKindOf)
    stand_in = @context.double(matcher.expected.instance_contract_inspect)
  else
    stand_in = matcher.expected
  end
  @context.fulfills(
    contract_message_signature(@object, @method, @args, [stand_in])
  )
end