Class: Bogus::VerifiesContracts

Inherits:
Object
  • Object
show all
Extended by:
Takes
Defined in:
lib/bogus/contracts/verifies_contracts.rb

Instance Method Summary collapse

Methods included from Takes

takes

Instance Method Details

#verify(fake_name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/bogus/contracts/verifies_contracts.rb', line 7

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