class Easy::Matchers::Validations::ValidateAbsenceOfMatcher

Public Class Methods

new(attributes) click to toggle source
Calls superclass method
# File lib/matchers/validations/absence_of.rb, line 9
def initialize(attributes)
  super(attributes, :absence)
end

Public Instance Methods

allow_blank(value = true) click to toggle source
# File lib/matchers/validations/absence_of.rb, line 54
def allow_blank(value = true)
  options[:allow_blank] = value
  self
end
allow_nil(value = true) click to toggle source
# File lib/matchers/validations/absence_of.rb, line 49
def allow_nil(value = true)
  options[:allow_nil] = value
  self
end
description() click to toggle source
# File lib/matchers/validations/absence_of.rb, line 25
def description
  "require #{ attributes.join(', ') } to not be set"
end
if(symbol_name) click to toggle source
# File lib/matchers/validations/absence_of.rb, line 34
def if(symbol_name)
  options[:if] = symbol_name
  self
end
matches?(subject) click to toggle source
Calls superclass method
# File lib/matchers/validations/absence_of.rb, line 13
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/absence_of.rb, line 44
def on(context)
  options[:on] = context
  self
end
strict(value) click to toggle source
# File lib/matchers/validations/absence_of.rb, line 59
def strict(value)
  options[:strict] = value
  self
end
unless(symbol_name) click to toggle source
# File lib/matchers/validations/absence_of.rb, line 39
def unless(symbol_name)
  options[:unless] = symbol_name
  self
end
with_message(message) click to toggle source
# File lib/matchers/validations/absence_of.rb, line 29
def with_message(message)
  options[:message] = message
  self
end