Class: Riot::NilMacro

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

Overview

Asserts that the result of the test is nil

asserts("test") { nil }.nil
should("test") { nil }.nil

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/nil.rb', line 8

def evaluate(actual)
  actual.nil? ? pass("is nil") : fail("expected nil, not #{actual.inspect}")
end