class Shoulda::Matchers::ActiveModel::NumericalityMatchers::OnlyIntegerMatcher

@private

Constants

NON_INTEGER_VALUE

Public Instance Methods

allowed_type_name() click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb, line 19
def allowed_type_name
  'integer'
end
diff_to_compare() click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb, line 23
def diff_to_compare
  1
end
simple_description() click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb, line 9
def simple_description
  description = ''

  if expects_strict?
    description << ' strictly'
  end

  description + "disallow :#{attribute} from being a decimal number"
end

Protected Instance Methods

disallowed_value() click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb, line 33
def disallowed_value
  if @numeric_type_matcher.given_numeric_column?
    NON_INTEGER_VALUE
  else
    NON_INTEGER_VALUE.to_s
  end
end
wrap_disallow_value_matcher(matcher) click to toggle source
# File lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb, line 29
def wrap_disallow_value_matcher(matcher)
  matcher.with_message(:not_an_integer)
end