class CallbacksOnDestroyUpdateActionRaceTest

Public Instance Methods

test_trigger_on_update_where_row_was_deleted() click to toggle source
# File activerecord/test/cases/transaction_callbacks_test.rb, line 486
def test_trigger_on_update_where_row_was_deleted
  TopicWithCallbacksOnUpdate.clear_history
  topic = TopicWithCallbacksOnUpdate.new
  topic.save
  topic_clone = TopicWithCallbacksOnUpdate.find(topic.id)
  topic.destroy
  topic_clone.author_name = "Test Author"
  topic_clone.save

  assert_equal [], TopicWithCallbacksOnUpdate.history
end
test_trigger_once_on_multiple_deletions() click to toggle source
# File activerecord/test/cases/transaction_callbacks_test.rb, line 475
def test_trigger_once_on_multiple_deletions
  TopicWithCallbacksOnDestroy.clear_history
  topic = TopicWithCallbacksOnDestroy.new
  topic.save
  topic_clone = TopicWithCallbacksOnDestroy.find(topic.id)
  topic.destroy
  topic_clone.destroy

  assert_equal [:destroy], TopicWithCallbacksOnDestroy.history
end