Sha256: f6abeda8f085185d0d8e52c1b6ad1b1b5b97fd8fabbb84182bc6f606a372b269

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 Bytes

Contents

module Shoulda # :nodoc:
  module Matchers
    module ActiveModel # :nodoc:
      module NumericalityMatchers
        class OnlyIntegerMatcher < NumericTypeMatcher # :nodoc:
          NON_INTEGER_VALUE = 0.1
          def initialize(attribute)
            @attribute = attribute
            @disallow_value_matcher = DisallowValueMatcher.new(NON_INTEGER_VALUE).
              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

4 entries across 4 versions & 1 rubygems

Version Path
shoulda-matchers-2.6.1 lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb
shoulda-matchers-2.6.1.rc2 lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb
shoulda-matchers-2.6.1.rc1 lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb
shoulda-matchers-2.6.0 lib/shoulda/matchers/active_model/numericality_matchers/only_integer_matcher.rb