public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Fix tests for postgres 8.3.x

Made test_with_limiting_with_custom_select not dependent on database
default order. Fixed tests with non-US monetary locale. The monetary
type is fixed precision so it should not expect the database to
return a float.

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Tarmo Tänav (author)
Sun May 25 15:28:56 -0700 2008
lifo (committer)
Sun May 25 16:45:42 -0700 2008
commit  c5d37c0662a65ce9723d668f57b59457e79ee5ca
tree    61c6aba0f774509405b22b41912593f2c1a0e489
parent  f88267d532ecbfebb66b95863a4875b65507ddf3
...
30
31
32
33
34
 
 
35
36
37
...
143
144
145
146
 
147
148
149
150
 
151
152
153
...
30
31
32
 
 
33
34
35
36
37
...
143
144
145
 
146
147
148
149
 
150
151
152
153
0
@@ -30,8 +30,8 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase
0
     @connection.execute("INSERT INTO postgresql_arrays (commission_by_quarter, nicknames) VALUES ( '{35000,21000,18000,17000}', '{foo,bar,baz}' )")
0
     @first_array = PostgresqlArray.find(1)
0
 
0
-    @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('$567.89')")
0
-    @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('-$567.89')")
0
+    @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('567.89'::money)")
0
+    @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('-567.89'::money)")
0
     @first_money = PostgresqlMoney.find(1)
0
     @second_money = PostgresqlMoney.find(2)
0
 
0
@@ -143,11 +143,11 @@ class PostgresqlDataTypeTest < ActiveRecord::TestCase
0
   end
0
 
0
   def test_update_money
0
-    new_value = 123.45
0
+    new_value = BigDecimal.new('123.45')
0
     assert @first_money.wealth = new_value
0
     assert @first_money.save
0
     assert @first_money.reload
0
-    assert_equal @first_money.wealth, new_value
0
+    assert_equal new_value, @first_money.wealth
0
   end
0
 
0
   def test_update_number
...
867
868
869
870
 
871
872
873
...
867
868
869
 
870
871
872
873
0
@@ -867,7 +867,7 @@ class FinderTest < ActiveRecord::TestCase
0
   end
0
 
0
   def test_with_limiting_with_custom_select
0
-    posts = Post.find(:all, :include => :author, :select => ' posts.*, authors.id as "author_id"', :limit => 3)
0
+    posts = Post.find(:all, :include => :author, :select => ' posts.*, authors.id as "author_id"', :limit => 3, :order => 'posts.id')
0
     assert_equal 3, posts.size
0
     assert_equal [0, 1, 1], posts.map(&:author_id).sort
0
   end

Comments