Sha256: 028c2956bed3a9ece0cede12af4a30d8f08a5df6267343b2e53237240d89abe1

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

require 'java'
require 'models/data_types'
require 'arjdbc'
require 'test/unit'

JInteger = java.lang.Integer

class TypeConversionTest < Test::Unit::TestCase
  TEST_TIME = Time.at(1169964202).gmtime
  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

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-jdbc-adapter-1.2.5 test/activerecord/connection_adapters/type_conversion_test.rb