aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2017-05-28 22:05:10 -0500
committerGitHub <noreply@github.com>2017-05-28 22:05:10 -0500
commit109bca95022d9471c0aafb9efeb4ba8eb6d99832 (patch)
tree1c4a75608971c9afba27e4653805f86628fdaea6 /activerecord/test/cases
parentacdf234a4cf28fdf20dcd49ac4013d84448d65b1 (diff)
parent36417cf07790b645b3f3c0fde095d1059bcf0ea9 (diff)
downloadrails-109bca95022d9471c0aafb9efeb4ba8eb6d99832.tar.gz
rails-109bca95022d9471c0aafb9efeb4ba8eb6d99832.tar.bz2
rails-109bca95022d9471c0aafb9efeb4ba8eb6d99832.zip
Merge pull request #29262 from kamipo/deprecate_passing_arguments_with_block_to_count_and_sum
Deprecate passing arguments and block at the same time to `count` and `sum` in `ActiveRecord::Calculations`
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/calculations_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb
index 3214d778d4..93f8ab18c2 100644
--- a/activerecord/test/cases/calculations_test.rb
+++ b/activerecord/test/cases/calculations_test.rb
@@ -809,4 +809,16 @@ class CalculationsTest < ActiveRecord::TestCase
def test_group_by_attribute_with_custom_type
assert_equal({ "proposed" => 2, "published" => 2 }, Book.group(:status).count)
end
+
+ def test_deprecate_count_with_block_and_column_name
+ assert_deprecated do
+ assert_equal 6, Account.count(:firm_id) { true }
+ end
+ end
+
+ def test_deprecate_sum_with_block_and_column_name
+ assert_deprecated do
+ assert_equal 6, Account.sum(:firm_id) { 1 }
+ end
+ end
end