提交 a1ca1e85 编写于 作者: A Aaron Patterson 提交者: Vijay Dev

persisted? should be able to return a truthy object

上级 bda16eb0
......@@ -370,23 +370,23 @@ def test_restore_active_record_state_for_all_records_in_a_transaction
assert topic_2.save
@first.save
@second.destroy
assert_equal true, topic_1.persisted?
assert topic_1.persisted?, 'persisted'
assert_not_nil topic_1.id
assert_equal true, topic_2.persisted?
assert topic_2.persisted?, 'persisted'
assert_not_nil topic_2.id
assert_equal true, @first.persisted?
assert @first.persisted?, 'persisted'
assert_not_nil @first.id
assert_equal true, @second.destroyed?
assert @second.destroyed?, 'destroyed'
raise ActiveRecord::Rollback
end
assert_equal false, topic_1.persisted?
assert !topic_1.persisted?, 'not persisted'
assert_nil topic_1.id
assert_equal false, topic_2.persisted?
assert !topic_2.persisted?, 'not persisted'
assert_nil topic_2.id
assert_equal true, @first.persisted?
assert @first.persisted?, 'persisted'
assert_not_nil @first.id
assert_equal false, @second.destroyed?
assert !@second.destroyed?, 'not destroyed'
end
if current_adapter?(:PostgreSQLAdapter) && defined?(PGconn::PQTRANS_IDLE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册