persisted? should be able to return a truthy object

This commit is contained in:
Aaron Patterson 2010-12-13 11:39:31 -08:00 committed by Vijay Dev
parent bda16eb092
commit a1ca1e85a9
1 changed files with 8 additions and 8 deletions

View File

@ -370,23 +370,23 @@ class TransactionTest < ActiveRecord::TestCase
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)