Sha256: 542de8e32cc63ea5fcc1c535abb74369a370637cfd90255267d315dfc8c2e8a6

Contents?: true

Size: 622 Bytes

Versions: 1

Compression:

Stored size: 622 Bytes

Contents

module Shoulda
  module Matchers
    module ActiveModel
      module NumericalityMatchers
        # @private
        class OnlyIntegerMatcher < NumericTypeMatcher
          NON_INTEGER_VALUE = 0.1
          def initialize(attribute)
            @attribute = attribute
            @disallow_value_matcher =
              DisallowValueMatcher.new(NON_INTEGER_VALUE.to_s).
              for(attribute).
              with_message(:not_an_integer)
          end

          def allowed_type
            'integers'
          end

          def diff_to_compare
            1
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoulda-matchers-3.0.0 lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb