提交 eb053fa8 编写于 作者: G Guillermo Iguaran 提交者: GitHub

Merge pull request #29453 from kamipo/add_test_case_for_28274

Add test cases for #28274
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册