Sha256: fb457891f1297531bf99f1b58455ab6c7b26aa4de7f8ae00bd14627409db0bd2
Contents?: true
Size: 612 Bytes
Versions: 3
Compression:
Stored size: 612 Bytes
Contents
module Riot # Asserts that the result of the test is nil # # asserts("test") { nil }.nil # should("test") { nil }.nil # # You could test that the result is not nil, but it would make more sense to use the +exists+ macro: # # denies("test") { "foo" }.nil # asserts("test") { "foo" }.exists class NilMacro < AssertionMacro register :nil def evaluate(actual) actual.nil? ? pass("is nil") : fail(expected_message.nil.not(actual)) end def devaluate(actual) actual.nil? ? fail(expected_message.is_nil.not('non-nil')) : pass("is not nil") end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
riot-0.12.1 | lib/riot/assertion_macros/nil.rb |
riot-0.12.0 | lib/riot/assertion_macros/nil.rb |
riot-0.12.0.pre | lib/riot/assertion_macros/nil.rb |