Sha256: c0669928502abb15db58add084f7014ccb1c18166d7e40f5af0c0c7f3cebd7a6

Contents?: true

Size: 666 Bytes

Versions: 6

Compression:

Stored size: 666 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

6 entries across 6 versions & 2 rubygems

Version Path
ibm_db-5.5.0 test/cases/type/integer_test.rb
ibm_db-5.4.1 test/cases/type/integer_test.rb
ibm_db-5.4.0 test/cases/type/integer_test.rb
ibm_db-5.3.2 test/cases/type/integer_test.rb
ibm_db-5.3.1 test/cases/type/integer_test.rb
ruby-on-quails-0.1.0 activerecord/test/cases/type/integer_test.rb