class Shoulda::Matchers::ActiveModel::NumericalityMatchers::OnlyIntegerMatcher
@private
Constants
- NON_INTEGER_VALUE
Public Instance Methods
Source
# File lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb, line 19 def allowed_type_name 'integer' end
Source
# File lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb, line 23 def diff_to_compare 1 end
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
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
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