Method: Muack::Unexpected#initialize

Defined in:
lib/muack/failure.rb

#initialize(obj, expected_defis, msg, args) ⇒ Unexpected

Returns a new instance of Unexpected.



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

def initialize obj, expected_defis, msg, args
  @was = "#{obj.inspect}.#{msg}(" \
         "#{args.map(&:inspect).join(', ')})"
  if expected_defis.empty?
    super("\nUnexpected call: #{@was}")
  else
    build_expected(obj, expected_defis)
    super("\nExpected: #{expected}\n but was: #{was}")
  end
end