Sha256: 5837d564dfdefb3f76b55a1b32d13c5b7a89e75db92298307d03aa31262b6ae2

Contents?: true

Size: 701 Bytes

Versions: 10

Compression:

Stored size: 701 Bytes

Contents

require 'java'
require 'models/data_types'
require 'active_record/connection_adapters/jdbc_adapter'
require 'db/derby'
require 'test/unit'

JInteger = java.lang.Integer

class TypeConversionTest < Test::Unit::TestCase
  TEST_TIME = Time.at(1169964202)
  def setup
    DbTypeMigration.up  
    DbType.create(
      :sample_timestamp => TEST_TIME,
      :sample_decimal => JInteger::MAX_VALUE + 1)
  end
  
  def teardown
    DbTypeMigration.down
  end
  
  def test_timestamp
    types = DbType.find(:first)
    assert_equal TEST_TIME, types.sample_timestamp.getutc
  end
  
  def test_decimal
    types = DbType.find(:first)
    assert_equal((JInteger::MAX_VALUE + 1), types.sample_decimal)
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
activerecord-jdbc-adapter-0.9.0.1 test/activerecord/connection_adapters/type_conversion_test.rb
ActiveRecord-JDBC-0.5 test/activerecord/connection_adapters/type_conversion_test.rb
activerecord-jdbc-adapter-0.7 test/activerecord/connection_adapters/type_conversion_test.rb
activerecord-jdbc-adapter-0.7.1 test/activerecord/connection_adapters/type_conversion_test.rb
activerecord-jdbc-adapter-0.8.2 test/activerecord/connection_adapters/type_conversion_test.rb
activerecord-jdbc-adapter-0.9 test/activerecord/connection_adapters/type_conversion_test.rb
activerecord-jdbc-adapter-0.8 test/activerecord/connection_adapters/type_conversion_test.rb
activerecord-jdbc-adapter-0.7.2 test/activerecord/connection_adapters/type_conversion_test.rb
activerecord-jdbc-adapter-0.8.1 test/activerecord/connection_adapters/type_conversion_test.rb
activerecord-jdbc-adapter-0.6 test/activerecord/connection_adapters/type_conversion_test.rb