Class: Riot::AnyMacro
- Inherits:
-
AssertionMacro
- Object
- AssertionMacro
- Riot::AnyMacro
- Defined in:
- lib/riot/assertion_macros/any.rb
Overview
Asserts the result has items
asserts("an array") { [1] }.any
asserts("a hash") { {:name => 'washington'} }.any
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
#evaluate(actual) ⇒ Object
8 9 10 |
# File 'lib/riot/assertion_macros/any.rb', line 8 def evaluate(actual) actual.any? ? pass("is not empty") : fail((actual).to_have_items) end |