aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/transaction_callbacks_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-11-07 23:25:07 +0900
committerGitHub <noreply@github.com>2018-11-07 23:25:07 +0900
commitd84bc2b169cc0b67abe9e7efe7aa301fca570aa7 (patch)
tree55d8ae14eac6938c4ffc97f88c75dba4b7125f30 /activerecord/test/cases/transaction_callbacks_test.rb
parent8eaffe7e89719ac62ff29c2e4208cfbeb1cd1c38 (diff)
parent9030b7c7751ba8375697baaee461b1a6435ad5fe (diff)
downloadrails-d84bc2b169cc0b67abe9e7efe7aa301fca570aa7.tar.gz
rails-d84bc2b169cc0b67abe9e7efe7aa301fca570aa7.tar.bz2
rails-d84bc2b169cc0b67abe9e7efe7aa301fca570aa7.zip
Merge pull request #34393 from eugeneius/always_add_to_parent_transaction
Always add records to parent of nested transaction
Diffstat (limited to 'activerecord/test/cases/transaction_callbacks_test.rb')
-rw-r--r--activerecord/test/cases/transaction_callbacks_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/transaction_callbacks_test.rb b/activerecord/test/cases/transaction_callbacks_test.rb
index c0be45eee7..aa6b7915a2 100644
--- a/activerecord/test/cases/transaction_callbacks_test.rb
+++ b/activerecord/test/cases/transaction_callbacks_test.rb
@@ -591,6 +591,17 @@ class TransactionEnrollmentCallbacksTest < ActiveRecord::TestCase
assert_equal [:before_commit, :after_commit], @topic.history
end
+ def test_commit_run_transactions_callbacks_with_nested_transactions
+ @topic.transaction do
+ @topic.transaction(requires_new: true) do
+ @topic.content = "foo"
+ @topic.save!
+ @topic.class.connection.add_transaction_record(@topic)
+ end
+ end
+ assert_equal [:before_commit, :after_commit], @topic.history
+ end
+
def test_rollback_does_not_run_transactions_callbacks_without_enrollment
@topic.transaction do
@topic.content = "foo"