Parent

Shoulda::Matchers::ActiveModel::ValidateNumericalityOfMatcher

Constants

NON_NUMERIC_VALUE

Public Class Methods

new(attribute) click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 27
def initialize(attribute)
  @attribute = attribute
  @submatchers = []

  add_disallow_value_matcher
end

Public Instance Methods

description() click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 86
def description
  "only allow #{allowed_types} values for #{@attribute}"
end
even() click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 70
def even
  even_number_matcher = OddEvenNumberMatcher.new(@attribute, :even => true)
  add_submatcher(even_number_matcher)
  self
end
failure_message_for_should() click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 90
def failure_message_for_should
  submatcher_failure_messages_for_should.last
end
failure_message_for_should_not() click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 94
def failure_message_for_should_not
  submatcher_failure_messages_for_should_not.last
end
is_equal_to(value) click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 49
def is_equal_to(value)
  add_submatcher(ComparisonMatcher.new(value, :==).for(@attribute))
  self
end
is_greater_than(value) click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 39
def is_greater_than(value)
  add_submatcher(ComparisonMatcher.new(value, :>).for(@attribute))
  self
end
is_greater_than_or_equal_to(value) click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 44
def is_greater_than_or_equal_to(value)
  add_submatcher(ComparisonMatcher.new(value, :>=).for(@attribute))
  self
end
is_less_than(value) click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 54
def is_less_than(value)
  add_submatcher(ComparisonMatcher.new(value, :<).for(@attribute))
  self
end
is_less_than_or_equal_to(value) click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 59
def is_less_than_or_equal_to(value)
  add_submatcher(ComparisonMatcher.new(value, :<=).for(@attribute))
  self
end
matches?(subject) click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 81
def matches?(subject)
  @subject = subject
  submatchers_match?
end
odd() click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 64
def odd
  odd_number_matcher = OddEvenNumberMatcher.new(@attribute, :odd => true)
  add_submatcher(odd_number_matcher)
  self
end
only_integer() click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 34
def only_integer
  add_submatcher(OnlyIntegerMatcher.new(@attribute))
  self
end
with_message(message) click to toggle source
# File lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb, line 76
def with_message(message)
  @submatchers.each { |matcher| matcher.with_message(message) }
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.