Class: Riot::RespondToMacro
- Inherits:
-
AssertionMacro
- Object
- AssertionMacro
- Riot::RespondToMacro
- Defined in:
- lib/riot/assertion_macros/respond_to.rb
Overview
Asserts that the result of the test is an object that responds to the given method
asserts("test") { "foo" }.respond_to(:to_s)
should("test") { "foo" }.respond_to(:to_s)
Instance Method Summary collapse
Methods inherited from AssertionMacro
default, #error, expects_exception!, #expects_exception?, #fail, #pass, register
Instance Method Details
#evaluate(actual, expected) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/riot/assertion_macros/respond_to.rb', line 8 def evaluate(actual, expected) if actual.respond_to?(expected) pass("responds to #{expected.inspect}") else fail("expected method #{expected.inspect} is not defined") end end |