Sha256: 70b5673ca3659bb1d64594d5951095758770fee7690fd0819a02885a163b29a3
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
module Riot # Asserts that the result of the test is equivalent to the expected value. Using the +===+ operator. # # asserts("test") { "foo" }.equivalent_to(String) # should("test") { "foo" }.equivalent_to("foo") # asserts("test") { "foo" }.equivalent_to { "foo" } # # You can also assert that the expected value is not equivalent to something else: # # denies("test") { "foo" }.equivalent_to(Boolean) # denies("test") { "foo" }.equivalent_to("bar") # # Underneath the hood, this assertion macro uses: # # expected === actual class EquivalentToMacro < AssertionMacro register :equivalent_to def evaluate(actual, expected) if expected === actual pass new_message.is_equivalent_to(expected) else fail expected_message(actual).to_be_equivalent_to(expected) end end def devaluate(actual, expected) if expected === actual fail expected_message(actual).not_to_be_equivalent_to(expected) else pass new_message.is_not_equivalent_to(expected) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
riot-0.12.1 | lib/riot/assertion_macros/equivalent_to.rb |
riot-0.12.0 | lib/riot/assertion_macros/equivalent_to.rb |
riot-0.12.0.pre | lib/riot/assertion_macros/equivalent_to.rb |