@@ -204,12 +204,12 @@ def test_only_call_after_commit_on_create_after_transaction_commits_for_new_reco
204
204
assert_equal [ ] , reply . history
205
205
end
206
206
207
- def test_only_call_after_commit_on_destroy_after_transaction_commits_for_destroyed_new_record
207
+ def test_no_after_commit_on_destroy_after_transaction_commits_for_destroyed_new_record
208
208
new_record = TopicWithCallbacks . new ( title : "New topic" , written_on : Date . today )
209
209
add_transaction_execution_blocks new_record
210
210
211
211
new_record . destroy
212
- assert_equal [ :commit_on_destroy ] , new_record . history
212
+ assert_equal [ ] , new_record . history
213
213
end
214
214
215
215
def test_save_in_after_create_commit_wont_invoke_extra_after_create_commit
@@ -674,7 +674,7 @@ class TopicWithCallbacksOnUpdate < TopicWithHistory
674
674
def before_save_for_transaction ; end
675
675
end
676
676
677
- def test_trigger_once_on_multiple_deletions
677
+ def test_trigger_once_on_multiple_deletion_within_transaction
678
678
TopicWithCallbacksOnDestroy . clear_history
679
679
topic = TopicWithCallbacksOnDestroy . new
680
680
topic . save
@@ -689,6 +689,19 @@ def test_trigger_once_on_multiple_deletions
689
689
assert_equal [ :commit_on_destroy ] , TopicWithCallbacksOnDestroy . history
690
690
end
691
691
692
+ def test_trigger_once_on_multiple_deletions
693
+ TopicWithCallbacksOnDestroy . clear_history
694
+ topic = TopicWithCallbacksOnDestroy . new
695
+ topic . save
696
+ topic_clone = TopicWithCallbacksOnDestroy . find ( topic . id )
697
+
698
+ topic . destroy
699
+ topic . destroy
700
+ topic_clone . destroy
701
+
702
+ assert_equal [ :commit_on_destroy ] , TopicWithCallbacksOnDestroy . history
703
+ end
704
+
692
705
def test_rollback_on_multiple_deletions
693
706
TopicWithCallbacksOnDestroy . clear_history
694
707
topic = TopicWithCallbacksOnDestroy . new
0 commit comments