Class: Riot::EqualsMacro
- Inherits:
-
AssertionMacro
- Object
- AssertionMacro
- Riot::EqualsMacro
- Defined in:
- lib/riot/assertion_macros/equals.rb
Overview
Asserts that the result of the test equals the expected value. Using the === operator to assert equality.
asserts("test") { "foo" }.equals("foo")
should("test") { "foo" }.equals("foo")
asserts("test") { "foo" }.equals { "foo" }
Instance Method Summary collapse
Methods inherited from AssertionMacro
default, #error, expects_exception!, #expects_exception?, #fail, #pass, register
Instance Method Details
#evaluate(actual, expected) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/riot/assertion_macros/equals.rb', line 10 def evaluate(actual, expected) if expected === actual pass("is equal to #{expected.inspect}") else fail("expected #{expected.inspect}, not #{actual.inspect}") end end |