Permalink
Browse files

Merge pull request #29453 from kamipo/add_test_case_for_28274

Add test cases for #28274
  • Loading branch information...
guilleiguaran committed Jun 15, 2017
2 parents 95ae033 + 249fcbe commit eb053fa8e22c95b1f8e2114c16f1e23299e90619
Showing with 46 additions and 0 deletions.
  1. +46 −0 activerecord/test/cases/transactions_test.rb
@@ -595,6 +595,52 @@ def test_restore_frozen_state_after_double_destroy
assert_not topic.frozen?
end
def test_restore_id_after_rollback
topic = Topic.new
Topic.transaction do
topic.save!
raise ActiveRecord::Rollback
end
assert_nil topic.id
end
def test_restore_custom_primary_key_after_rollback
movie = Movie.new(name: "foo")
Movie.transaction do
movie.save!
raise ActiveRecord::Rollback
end
assert_nil movie.id
end
def test_assign_id_after_rollback
topic = Topic.create!
Topic.transaction do
topic.save!
raise ActiveRecord::Rollback
end
topic.id = nil
assert_nil topic.id
end
def test_assign_custom_primary_key_after_rollback
movie = Movie.create!(name: "foo")
Movie.transaction do
movie.save!
raise ActiveRecord::Rollback
end
movie.id = nil
assert_nil movie.id
end
def test_rollback_of_frozen_records
topic = Topic.create.freeze
Topic.transaction do

0 comments on commit eb053fa

Please sign in to comment.