Class: Ward::Matchers::Nil

Inherits:
Matcher
  • Object
show all
Defined in:
lib/ward/matchers/nil.rb

Overview

TODO:

Remove once the predicate matcher DSL is available.

Tests whether the validation value is nil.

Examples:


class AverageDogWalker
  validate do |walker|
    walker.common_sense.is.nil  # Sigh.
  end
end

Instance Attribute Summary

Attributes inherited from Matcher

#expected, #extra_args

Instance Method Summary collapse

Methods inherited from Matcher

#customise_error_values, error_id, #initialize

Constructor Details

This class inherits a constructor from Ward::Matchers::Matcher

Instance Method Details

#matches?(actual) ⇒ Boolean

Returns whether the given value is nil.

Parameters:

  • actual (Object)

    The validation value.

Returns:

  • (Boolean)


24
25
26
# File 'lib/ward/matchers/nil.rb', line 24

def matches?(actual)
  actual.nil?
end