Sha256: 3c08c6a6e725109abd914cc1ca81a5a12210781f57700634a88a300fc6fa60da
Contents?: true
Size: 825 Bytes
Versions: 3
Compression:
Stored size: 825 Bytes
Contents
module Riot # Asserts that the result of the test is an object that is a kind of the expected type # # asserts("test") { "foo" }.kind_of(String) # should("test") { "foo" }.kind_of(String) # # You can also test the result is not a kind of a thing: # # denies("test") { "foo" }.kind_of(Boolean) class KindOfMacro < AssertionMacro register :kind_of def evaluate(actual, expected) if actual.kind_of?(expected) pass new_message.is_a_kind_of(expected) else fail expected_message.kind_of(expected).not(actual.class) end end def devaluate(actual, expected) if actual.kind_of?(expected) fail expected_message.not_kind_of(expected).not(actual.class) else pass new_message.is_not_a_kind_of(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/kind_of.rb |
riot-0.12.0 | lib/riot/assertion_macros/kind_of.rb |
riot-0.12.0.pre | lib/riot/assertion_macros/kind_of.rb |