aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/calculations_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-26 17:02:45 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-26 17:02:45 +0000
commita0bf0195a5c27c8c8493b1a44987154a9dc0d526 (patch)
tree9c48753be9e25512a3dd58fde92af218fb0f5db7 /activerecord/test/calculations_test.rb
parentc554a9cabaa3c8bbed5a0dccb381fdc6d516972d (diff)
downloadrails-a0bf0195a5c27c8c8493b1a44987154a9dc0d526.tar.gz
rails-a0bf0195a5c27c8c8493b1a44987154a9dc0d526.tar.bz2
rails-a0bf0195a5c27c8c8493b1a44987154a9dc0d526.zip
Deprecation: count class method should be called with an options hash rather than two args for conditions and joins. Closes #6287.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5192 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/calculations_test.rb')
-rw-r--r--activerecord/test/calculations_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/calculations_test.rb b/activerecord/test/calculations_test.rb
index 397b7a9026..23c45f8637 100644
--- a/activerecord/test/calculations_test.rb
+++ b/activerecord/test/calculations_test.rb
@@ -196,4 +196,16 @@ class CalculationsTest < Test::Unit::TestCase
assert_equal 6, Account.count(:distinct => true, :include => :firm)
assert_equal 4, Account.count(:distinct => true, :include => :firm, :select => :credit_limit)
end
+
+ def test_deprecated_count_with_string_parameters
+ assert_deprecated('count') { Account.count('credit_limit > 50') }
+ end
+
+ def test_count_with_no_parameters_isnt_deprecated
+ assert_not_deprecated { Account.count }
+ end
+
+ def test_count_with_too_many_parameters_raises
+ assert_raise(ArgumentError) { Account.count(1, 2, 3) }
+ end
end