Sha256: fdfd670a7c969b87d71d088a94c89d1133b6b01b24daacbac512468ec39b5c38

Contents?: true

Size: 695 Bytes

Versions: 4

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

require "cases/helper"
require "models/company"

module ActiveRecord
  module Type
    class IntegerTest < ActiveRecord::TestCase
      test "casting ActiveRecord models" do
        type = Type::Integer.new
        firm = Firm.create(name: "Apple")
        assert_nil type.cast(firm)
      end

      test "values which are out of range can be re-assigned" do
        klass = Class.new(ActiveRecord::Base) do
          self.table_name = "posts"
          attribute :foo, :integer
        end
        model = klass.new

        model.foo = 2147483648
        model.foo = 1

        assert_equal 1, model.foo
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ibm_db-5.5.0-x86-mingw32 test/cases/type/integer_test.rb
ibm_db-5.4.1-x86-mingw32 test/cases/type/integer_test.rb
ibm_db-5.4.0-x86-mingw32 test/cases/type/integer_test.rb
ibm_db-5.3.2-x86-mingw32 test/cases/type/integer_test.rb