Class: Riot::AnyMacro

Inherits:
AssertionMacro show all
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 Method Summary collapse

Methods inherited from AssertionMacro

default, #error, expects_exception!, #expects_exception?, #fail, #pass, register

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("expected #{actual.inspect} to have items")
end