Class: Minicrest::NilValue

Inherits:
Matcher
  • Object
show all
Defined in:
lib/minicrest/value_matchers.rb

Overview

Matcher that checks if a value is nil.

Instance Method Summary collapse

Methods inherited from Matcher

#&, #|

Instance Method Details

#descriptionObject



12
13
14
# File 'lib/minicrest/value_matchers.rb', line 12

def description
  'nil'
end

#failure_message(actual) ⇒ Object



16
17
18
# File 'lib/minicrest/value_matchers.rb', line 16

def failure_message(actual)
  "expected #{actual.inspect} to be nil"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/minicrest/value_matchers.rb', line 8

def matches?(actual)
  actual.nil?
end

#negated_failure_message(actual) ⇒ Object



20
21
22
# File 'lib/minicrest/value_matchers.rb', line 20

def negated_failure_message(actual)
  "expected #{actual.inspect} not to be nil, but it was"
end