Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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>
  • Loading branch information...
commit c5d37c0662a65ce9723d668f57b59457e79ee5ca 1 parent f88267d
@tarmo tarmo authored lifo committed
View
8 activerecord/test/cases/datatype_test_postgresql.rb
@@ -30,8 +30,8 @@ def setup
@connection.execute("INSERT INTO postgresql_arrays (commission_by_quarter, nicknames) VALUES ( '{35000,21000,18000,17000}', '{foo,bar,baz}' )")
@first_array = PostgresqlArray.find(1)
- @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('$567.89')")
- @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('-$567.89')")
+ @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('567.89'::money)")
+ @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('-567.89'::money)")
@first_money = PostgresqlMoney.find(1)
@second_money = PostgresqlMoney.find(2)
@@ -143,11 +143,11 @@ def test_update_text_array
end
def test_update_money
- new_value = 123.45
+ new_value = BigDecimal.new('123.45')
assert @first_money.wealth = new_value
assert @first_money.save
assert @first_money.reload
- assert_equal @first_money.wealth, new_value
+ assert_equal new_value, @first_money.wealth
end
def test_update_number
View
2  activerecord/test/cases/finder_test.rb
@@ -867,7 +867,7 @@ def test_find_with_order_on_included_associations_with_construct_finder_sql_for_
end
def test_with_limiting_with_custom_select
- posts = Post.find(:all, :include => :author, :select => ' posts.*, authors.id as "author_id"', :limit => 3)
+ posts = Post.find(:all, :include => :author, :select => ' posts.*, authors.id as "author_id"', :limit => 3, :order => 'posts.id')
assert_equal 3, posts.size
assert_equal [0, 1, 1], posts.map(&:author_id).sort
end
Please sign in to comment.
Something went wrong with that request. Please try again.