Method: Riot::RespondToMacro#devaluate

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

#devaluate(actual, expected) ⇒ Array

Supports negative/converse assertion testing. This is also where magic happens.

Parameters:

  • actual (Object)

    the value returned from evaling the Assertion block

  • expected (Symbol, String)

    the method name that actual should not respond to

Returns:



26
27
28
29
30
31
32
# File 'lib/riot/assertion_macros/respond_to.rb', line 26

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