Class: Riot::AnyMacro Deprecated
- Inherits:
-
AssertionMacro
- Object
- AssertionMacro
- Riot::AnyMacro
- Defined in:
- lib/riot/assertion_macros/any.rb
Overview
Deprecated.
Please use asserts.empty
or denies.empty
instead.
In the positive case, asserts the result has items using the any?
operator.
asserts("an array") { [1] }.any
asserts("a hash") { {:name => 'washington'} }.any
In the negative case, asserts the result has no items using the any?
operator.
denies("an empty array") { [] }.any
denies("an empty hash") { {} }.any
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.
23 24 25 26 |
# File 'lib/riot/assertion_macros/any.rb', line 23 def devaluate(actual) warn "any is deprecated; please use asserts.empty or denies.empty instead" any?(actual) ? fail((actual).not_to_have_items) : pass("has items") end |
#evaluate(actual) ⇒ Array
Supports positive assertion testing. This is where magic happens.
17 18 19 20 |
# File 'lib/riot/assertion_macros/any.rb', line 17 def evaluate(actual) warn "any is deprecated; please use asserts.empty or denies.empty instead" any?(actual) ? pass("has items") : fail((actual).to_have_items) end |