Sha256: 9749d50b7cd1d36e9ff91b3c987e3fcd5c12b5cd9bb218ff38d962d686ccac0d

Contents?: true

Size: 638 Bytes

Versions: 8

Compression:

Stored size: 638 Bytes

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
ibm_db-5.2.0 test/cases/type/integer_test.rb
ibm_db-5.1.0 test/cases/type/integer_test.rb
ibm_db-5.0.5 test/cases/type/integer_test.rb
ibm_db-5.0.4 test/cases/type/integer_test.rb
ibm_db-5.0.3 test/cases/type/integer_test.rb
ibm_db-5.0.2 test/cases/type/integer_test.rb
ibm_db-4.0.0-x86-mingw32 test/cases/type/integer_test.rb
ibm_db-4.0.0 test/cases/type/integer_test.rb