Sha256: 652c94aa2d9720d0e2d7f0fba0d4a7ff4379dd1af17ceca9f8d6edd2853568c7

Contents?: true

Size: 665 Bytes

Versions: 6

Compression:

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

6 entries across 6 versions & 1 rubygems

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