Exception: Muack::Unexpected

Inherits:
Failure
  • Object
show all
Defined in:
lib/muack/failure.rb

Instance Attribute Summary collapse

Attributes inherited from Failure

#expected

Instance Method Summary collapse

Methods inherited from Failure

#build_expected

Constructor Details

#initialize(obj, expected_defis, actual_call) ⇒ Unexpected

Returns a new instance of Unexpected.



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/muack/failure.rb', line 15

def initialize obj, expected_defis, actual_call
  args = actual_call.args.map(&:inspect)
  @was = "#{obj.inspect}.#{actual_call.msg}(#{args.join(', ')})"

  if expected_defis.empty?
    super("\nUnexpected call: #{was}")
  else
    build_expected(obj, expected_defis)
    super("\nExpected: #{expected}\n but was: #{was}")
  end
end

Instance Attribute Details

#wasObject (readonly)

Returns the value of attribute was.



14
15
16
# File 'lib/muack/failure.rb', line 14

def was
  @was
end