Exception: Bogus::ContractNotFulfilled

Inherits:
StandardError
  • Object
show all
Defined in:
lib/bogus/contracts/contract_not_fulfilled.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fake_name, opts = {}) ⇒ ContractNotFulfilled

Returns a new instance of ContractNotFulfilled.



5
6
7
8
9
10
# File 'lib/bogus/contracts/contract_not_fulfilled.rb', line 5

def initialize(fake_name, opts = {})
  @fake_name = fake_name
  @actual_interactions = opts.fetch(:actual)
  @missed_interactions = opts.fetch(:missed)
  super(message)
end

Instance Attribute Details

#actual_interactionsObject (readonly)

Returns the value of attribute actual_interactions.



3
4
5
# File 'lib/bogus/contracts/contract_not_fulfilled.rb', line 3

def actual_interactions
  @actual_interactions
end

#fake_nameObject (readonly)

Returns the value of attribute fake_name.



3
4
5
# File 'lib/bogus/contracts/contract_not_fulfilled.rb', line 3

def fake_name
  @fake_name
end

#missed_interactionsObject (readonly)

Returns the value of attribute missed_interactions.



3
4
5
# File 'lib/bogus/contracts/contract_not_fulfilled.rb', line 3

def missed_interactions
  @missed_interactions
end

Instance Method Details

#messageObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bogus/contracts/contract_not_fulfilled.rb', line 12

def message
  str = <<-EOF
  Contract not fullfilled for #{fake_name}!

  Missed interactions:
  #{interactions_str(missed_interactions)}

  Actual interactions:
  #{interactions_str(actual_interactions)}
  EOF
  str.gsub(' ' * 6, '')
end