Method: Riot::RespondToMacro#evaluate

Defined in:
lib/riot/assertion_macros/respond_to.rb

#evaluate(actual, expected) ⇒ Array

Supports positive assertion testing. This is where magic happens.

Parameters:

  • actual (Object)

    the value returned from evaling the Assertion block

  • expected (Symbol, String)

    the method name that actual should respond to

Returns:



16
17
18
19
20
21
22
# File 'lib/riot/assertion_macros/respond_to.rb', line 16

def evaluate(actual, expected)
  if actual.respond_to?(expected)
    pass(new_message.responds_to(expected))
  else
    fail(expected_message.method(expected).is_not_defined)
  end
end