aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-07-20 09:12:09 -0600
committerSean Griffin <sean@thoughtbot.com>2015-07-20 09:12:09 -0600
commitc0f79be895796562e38e3fbd35d2741ee3fb85a5 (patch)
treefc2cc53a6795ee099fec878e4c33f7337f05b476 /activerecord/test
parentc0ef95a1c6db3095c4b5f80f8044fbbbdfebeff1 (diff)
parent12b0b26df7560ab5199ba830586864085441508f (diff)
downloadrails-c0f79be895796562e38e3fbd35d2741ee3fb85a5.tar.gz
rails-c0f79be895796562e38e3fbd35d2741ee3fb85a5.tar.bz2
rails-c0f79be895796562e38e3fbd35d2741ee3fb85a5.zip
Merge pull request #20947
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/transactions_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb
index 4e163ca4a6..29a6ec7522 100644
--- a/activerecord/test/cases/transactions_test.rb
+++ b/activerecord/test/cases/transactions_test.rb
@@ -175,6 +175,13 @@ class TransactionTest < ActiveRecord::TestCase
assert topic.new_record?, "#{topic.inspect} should be new record"
end
+ def test_transaction_state_is_cleared_when_record_is_persisted
+ author = Author.create! name: 'foo'
+ author.name = nil
+ assert_not author.save
+ assert_not author.new_record?
+ end
+
def test_update_should_rollback_on_failure
author = Author.find(1)
posts_count = author.posts.size