aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relations_test.rb
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2015-09-07 00:10:50 +0930
committerMatthew Draper <matthew@trebex.net>2015-09-07 00:10:50 +0930
commite07b006d9c7b0a57c350d918259176089d6dedd6 (patch)
tree4a10983dc01217aee4c8f2e620fd3d77fcea8927 /activerecord/test/cases/relations_test.rb
parentbc1f0c2e36ee705023dcbd513d99f834f8262ea3 (diff)
parentc82c5f8ffd7291186235c5912151c9dc0d262c4a (diff)
downloadrails-e07b006d9c7b0a57c350d918259176089d6dedd6.tar.gz
rails-e07b006d9c7b0a57c350d918259176089d6dedd6.tar.bz2
rails-e07b006d9c7b0a57c350d918259176089d6dedd6.zip
Merge pull request #21505 from morgoth/deprecate-passing-conditions-to-destroy_all-and-delete_all
Deprecate passing conditions to AR::Relation destroy_all and delete_all methods
Diffstat (limited to 'activerecord/test/cases/relations_test.rb')
-rw-r--r--activerecord/test/cases/relations_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 5f48c2b40f..8256762f96 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -931,6 +931,12 @@ class RelationTest < ActiveRecord::TestCase
assert davids.loaded?
end
+ def test_destroy_all_with_conditions_is_deprecated
+ assert_deprecated do
+ assert_difference('Author.count', -1) { Author.destroy_all(name: 'David') }
+ end
+ end
+
def test_delete_all
davids = Author.where(:name => 'David')
@@ -938,6 +944,12 @@ class RelationTest < ActiveRecord::TestCase
assert ! davids.loaded?
end
+ def test_delete_all_with_conditions_is_deprecated
+ assert_deprecated do
+ assert_difference('Author.count', -1) { Author.delete_all(name: 'David') }
+ end
+ end
+
def test_delete_all_loaded
davids = Author.where(:name => 'David')