Exception: Bogus::NotAllExpectationsSatisfied

Inherits:
StandardError
  • Object
show all
Defined in:
lib/bogus/stubbing/not_all_expectations_satisfied.rb

Class Method Summary collapse

Class Method Details

.create(unsatisfied_interactions, calls) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bogus/stubbing/not_all_expectations_satisfied.rb', line 3

def self.create(unsatisfied_interactions, calls)
  str = "  Some of the mocked interactions were not satisfied:\n\n  <% unsatisfied_interactions.each do |o, i| %>\n    - <%= render_interaction(o, i) %>\n  <% end %>\n\n  The following calls were recorded:\n\n  <% calls.each do |o, i| %>\n    - <%= render_interaction(o, i) %>\n  <% end %>\n  EOF\n  str = str.gsub(/ {6}/, '')\n  template = ERB.new(str, nil, \"<>\")\n  new(template.result(binding))\nend\n"

.render_interaction(object, interaction) ⇒ Object



22
23
24
25
# File 'lib/bogus/stubbing/not_all_expectations_satisfied.rb', line 22

def self.render_interaction(object, interaction)
  args = interaction.args.map(&:inspect).join(", ")
  "#{object.inspect}.#{interaction.method}(#{args})"
end