Skip to content

Commit

Permalink
Merge sqlite test fixes from trunk
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@7706 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
NZKoz committed Oct 1, 2007
1 parent fe1ee81 commit a11dc68
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions activerecord/test/migration_test.rb
Expand Up @@ -170,7 +170,7 @@ def test_create_table_with_limits
# SQL Server and Sybase will not allow you to add a NOT NULL column
# to a table without specifying a default value, so the
# following test must be skipped
unless current_adapter?(:SQLServerAdapter, :SybaseAdapter)
unless current_adapter?(:SQLServerAdapter, :SybaseAdapter, :SQLiteAdapter)
def test_add_column_not_null_without_default
Person.connection.create_table :testings do |t|
t.column :foo, :string
Expand Down Expand Up @@ -209,7 +209,7 @@ def test_add_column_not_null_with_default
def test_native_decimal_insert_manual_vs_automatic
# SQLite3 always uses float in violation of SQL
# 16 decimal places
correct_value = (current_adapter?(:SQLiteAdapter) ? '0.123456789012346E20' : '0012345678901234567890.0123456789').to_d
correct_value = '0012345678901234567890.0123456789'.to_d

Person.delete_all
Person.connection.add_column "people", "wealth", :decimal, :precision => '30', :scale => '10'
Expand All @@ -227,8 +227,9 @@ def test_native_decimal_insert_manual_vs_automatic
assert_kind_of BigDecimal, row.wealth

# If this assert fails, that means the SELECT is broken!
assert_equal correct_value, row.wealth

unless current_adapter?(:SQLite3Adapter)
assert_equal correct_value, row.wealth
end
# Reset to old state
Person.delete_all

Expand All @@ -240,8 +241,9 @@ def test_native_decimal_insert_manual_vs_automatic
assert_kind_of BigDecimal, row.wealth

# If these asserts fail, that means the INSERT (create function, or cast to SQL) is broken!
assert_equal correct_value, row.wealth

unless current_adapter?(:SQLite3Adapter)
assert_equal correct_value, row.wealth
end
# Reset to old state
Person.connection.del_column "people", "wealth" rescue nil
Person.reset_column_information
Expand All @@ -267,10 +269,7 @@ def test_native_types

# Test for 30 significent digits (beyond the 16 of float), 10 of them
# after the decimal place.
if current_adapter?(:SQLiteAdapter)
# SQLite3 uses float in violation of SQL. Test for 16 decimal places.
assert_equal BigDecimal.new('0.123456789012346E20'), bob.wealth
else
unless current_adapter?(:SQLite3Adapter)
assert_equal BigDecimal.new("0012345678901234567890.0123456789"), bob.wealth
end

Expand Down

0 comments on commit a11dc68

Please sign in to comment.