aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/calculations_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-03-07 16:36:40 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-03-07 16:36:40 +0000
commitdf8669d4b5691646ca8bb4ba01f6e5348ae8dd69 (patch)
tree6f5c5b216fb3d2ffd4885f896519936cbc93a00a /activerecord/test/cases/calculations_test.rb
parent272c2d2e9ca38a307878306bff4315183d1ae7ab (diff)
downloadrails-df8669d4b5691646ca8bb4ba01f6e5348ae8dd69.tar.gz
rails-df8669d4b5691646ca8bb4ba01f6e5348ae8dd69.tar.bz2
rails-df8669d4b5691646ca8bb4ba01f6e5348ae8dd69.zip
Fix calculation tests to work on sqlite
Diffstat (limited to 'activerecord/test/cases/calculations_test.rb')
-rw-r--r--activerecord/test/cases/calculations_test.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb
index 0257fe57cb..f01ac2ea39 100644
--- a/activerecord/test/cases/calculations_test.rb
+++ b/activerecord/test/cases/calculations_test.rb
@@ -265,14 +265,16 @@ class CalculationsTest < ActiveRecord::TestCase
end
def test_should_count_scoped_select
- Account.update_all("credit_limit = 50")
- assert_equal 1, Account.scoped(:select => "DISTINCT credit_limit").count
+ Account.update_all("credit_limit = NULL")
+ assert_equal 0, Account.scoped(:select => "credit_limit").count
end
def test_should_count_scoped_select_with_options
- Account.update_all("credit_limit = 50")
- Account.first.update_attribute('credit_limit', 49)
- assert_equal 1, Account.scoped(:select => "DISTINCT credit_limit").count(:conditions => [ 'credit_limit >= 50'] )
+ Account.update_all("credit_limit = NULL")
+ Account.last.update_attribute('credit_limit', 49)
+ Account.first.update_attribute('credit_limit', 51)
+
+ assert_equal 1, Account.scoped(:select => "credit_limit").count(:conditions => ['credit_limit >= 50'])
end
def test_should_count_manual_select_with_include