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 Attribute Summary
Attributes inherited from AssertionMacro
Instance Method Summary collapse
Methods inherited from AssertionMacro
default, #error, #expected_message, expects_exception!, #expects_exception?, #fail, #new_message, #pass, register, #should_have_message
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) else fail (expected).not(actual) end end |