Class: Shoulda::Matchers::ActiveModel::NumericalityMatchers::OnlyIntegerMatcher

Inherits:
NumericTypeMatcher
  • Object
show all
Defined in:
lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb

Constant Summary collapse

NON_INTEGER_VALUE =
0.1

Instance Method Summary collapse

Methods inherited from NumericTypeMatcher

#allowed_type_adjective, #initialize

Constructor Details

This class inherits a constructor from Shoulda::Matchers::ActiveModel::NumericalityMatchers::NumericTypeMatcher

Instance Method Details

#allowed_type_nameObject



19
20
21
# File 'lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb', line 19

def allowed_type_name
  'integer'
end

#diff_to_compareObject



23
24
25
# File 'lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb', line 23

def diff_to_compare
  1
end

#simple_descriptionObject



9
10
11
12
13
14
15
16
17
# 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