Class: Riot::NotMacro Deprecated
- Inherits:
-
AssertionMacro
- Object
- AssertionMacro
- Riot::NotMacro
- Defined in:
- lib/riot/assertion_macros/not_borat.rb
Overview
Please use the denies assertion instead
Asserts the result of the test is a non-truthy value. Read the following assertions in the way Borat learned about humor:
asserts("you are funny") { false }.not!
should("be funny") { nil }.not!
Thusly, Borat would say “You are funny … not!” The above two assertions would pass because the values are non-truthy.
You can also apply not to the negative assertion (denies), but I’m not sure how much sense it would make. It would be kind of like a double negative:
denies("you are funny") { true }.not!
Instance Attribute Summary
Attributes inherited from AssertionMacro
Instance Method Summary collapse
-
#devaluate(actual) ⇒ Array
Supports negative/converse assertion testing.
-
#evaluate(actual) ⇒ Array
Supports positive assertion testing.
Methods inherited from AssertionMacro
#error, #expected_message, expects_exception!, #expects_exception?, #fail, #new_message, #pass, register, #should_have_message
Instance Method Details
#devaluate(actual) ⇒ Array
Supports negative/converse assertion testing. This is also where magic happens.
27 28 29 30 |
# File 'lib/riot/assertion_macros/not_borat.rb', line 27 def devaluate(actual) warn "not! is deprecated; please use the denies assertion instead" actual ? pass("does not exist ... not!") : fail("expected to not exist ... not!") end |
#evaluate(actual) ⇒ Array
Supports positive assertion testing. This is where magic happens.
21 22 23 24 |
# File 'lib/riot/assertion_macros/not_borat.rb', line 21 def evaluate(actual) warn "not! is deprecated; please use the denies assertion instead" actual ? fail("expected to exist ... not!") : pass("does exist ... not!") end |