class Easy::Matchers::Validations::ValidateConfirmationOfMatcher

Attributes

confirmation_attributes[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 11
def initialize(attributes)
  super(attributes, :confirmation)
  @confirmation_attributes = attributes
end

Public Instance Methods

allow_blank(value = true) click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 57
def allow_blank(value = true)
  options[:allow_blank] = value
  self
end
allow_nil(value = true) click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 52
def allow_nil(value = true)
  options[:allow_nil] = value
  self
end
description() click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 28
def description
  "require #{ confirmation_attributes.join(', ') } to match #{ attributes.join(', ') }"
end
if(symbol_name) click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 37
def if(symbol_name)
  options[:if] = symbol_name
  self
end
matches?(subject) click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 16
def matches?(subject)
  super(subject)

  matched_validator = class_name.validators.detect do |validator|
    validator.kind == type &&
      validator.attributes.sort == attributes.sort &&
      validator.options.sort == options.sort
  end

  true if matched_validator
end
on(context) click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 47
def on(context)
  options[:on] = context
  self
end
strict(value) click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 62
def strict(value)
  options[:strict] = value
  self
end
unless(symbol_name) click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 42
def unless(symbol_name)
  options[:unless] = symbol_name
  self
end
with_message(message) click to toggle source
# File lib/matchers/validations/confirmation_of.rb, line 32
def with_message(message)
  options[:message] = message
  self
end