Class: Ward::Matchers::EqualTo

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

Overview

TODO:

Once the validator DSL is is available, amend the class documentation to provide an example of how to call is and is_not with a value.

Tests whether the validation value is equal in value to – but not necessarily the same object as – the expected value.

Examples:


class Person
  validate do |person|
    person.name.is.equal_to('Michael Scarn')
  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 equal to the expected value.

Parameters:

  • actual (Object)

    The validation value.

Returns:

  • (Boolean)


27
28
29
# File 'lib/ward/matchers/equal_to.rb', line 27

def matches?(actual)
  actual.eql?(@expected)
end