Class: Riot::NilMacro
- Inherits:
-
AssertionMacro
- Object
- AssertionMacro
- Riot::NilMacro
- Defined in:
- lib/riot/assertion_macros/nil.rb
Overview
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
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
#devaluate(actual) ⇒ Object
18 19 20 |
# File 'lib/riot/assertion_macros/nil.rb', line 18 def devaluate(actual) actual.nil? ? fail(.is_nil.not('non-nil')) : pass("is not nil") end |
#evaluate(actual) ⇒ Object
14 15 16 |
# File 'lib/riot/assertion_macros/nil.rb', line 14 def evaluate(actual) actual.nil? ? pass("is nil") : fail(.nil.not(actual)) end |