aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2014-04-28 19:15:42 -0400
committereileencodes <eileencodes@gmail.com>2014-04-28 19:15:42 -0400
commita0401aa22adcebb099f9d53fdb743b645d24cf94 (patch)
tree110ebb25e98f8b1ce2c5f41a34609bba6667a9c9 /activerecord/test
parentfe5d0988241cf34a378f05ce84e90c5d0636287a (diff)
downloadrails-a0401aa22adcebb099f9d53fdb743b645d24cf94.tar.gz
rails-a0401aa22adcebb099f9d53fdb743b645d24cf94.tar.bz2
rails-a0401aa22adcebb099f9d53fdb743b645d24cf94.zip
rewrite test to correctly test clear method
Clear should not call callbacks because it clear calls delete_all and then returns self. It should behave the same as delete_all. This test clarifies the goal of the test and tests the correct outcome.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/callbacks_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/callbacks_test.rb b/activerecord/test/cases/associations/callbacks_test.rb
index cf71bc1597..968f36e92c 100644
--- a/activerecord/test/cases/associations/callbacks_test.rb
+++ b/activerecord/test/cases/associations/callbacks_test.rb
@@ -150,7 +150,7 @@ class AssociationCallbacksTest < ActiveRecord::TestCase
"after_removing#{jamis.id}"], activerecord.developers_log
end
- def test_has_and_belongs_to_many_remove_callback_on_clear
+ def test_has_and_belongs_to_many_does_not_fire_callbacks_on_clear
activerecord = projects(:active_record)
assert activerecord.developers_log.empty?
if activerecord.developers_with_callbacks.size == 0
@@ -161,7 +161,7 @@ class AssociationCallbacksTest < ActiveRecord::TestCase
end
log_array = activerecord.developers_with_callbacks.flat_map {|d| ["before_removing#{d.id}","after_removing#{d.id}"]}.sort
assert activerecord.developers_with_callbacks.clear
- assert_equal log_array, activerecord.developers_log.sort
+ assert_predicate activerecord.developers_log, :empty?
end
def test_has_many_and_belongs_to_many_callbacks_for_save_on_parent