Class: Riot::EmptyMacro

Inherits:
AssertionMacro show all
Defined in:
lib/riot/assertion_macros/empty.rb

Overview

Asserts the result is empty

asserts("a string") { "" }.empty
asserts("an array") { [] }.empty
asserts("a hash") { Hash.new }.empty

Instance Method Summary collapse

Methods inherited from AssertionMacro

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

Instance Method Details

#evaluate(actual) ⇒ Object



9
10
11
# File 'lib/riot/assertion_macros/empty.rb', line 9

def evaluate(actual)
  actual.length == 0 ? pass : fail("expected #{actual.inspect} to be empty")
end