Class: Minicrest::Falsy

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

Overview

Matcher that checks Ruby falsiness.

Instance Method Summary collapse

Methods inherited from Matcher

#&, #|

Instance Method Details

#descriptionObject



50
51
52
# File 'lib/minicrest/value_matchers.rb', line 50

def description
  'falsy'
end

#failure_message(actual) ⇒ Object



54
55
56
# File 'lib/minicrest/value_matchers.rb', line 54

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

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/minicrest/value_matchers.rb', line 46

def matches?(actual)
  !actual
end

#negated_failure_message(actual) ⇒ Object



58
59
60
# File 'lib/minicrest/value_matchers.rb', line 58

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