On 4/11/07, Michael Koziarski <[EMAIL PROTECTED]> wrote:
> The exception implementation was much much simpler, so I've attached
> it to the ticket.
This fixes a failure in the SQLite3 build. There are two more tests
failing, for an entirely different reason. I'll write it up
separately.
Donning my tester's hat, I wrote a couple unit tests, the first of which fails:
def test_manually_rolling_back_a_nested_transaction
Topic.transaction do |transaction|
@first.approved = true
@second.approved = false
@first.save
Topic.transaction do |nested_transaction|
@second.save
nested_transaction.rollback!
end
end
assert @first.approved?, "First should still be changed in the objects"
assert [EMAIL PROTECTED], "Second should still be changed in the objects"
assert !Topic.find(1).approved?, "First shouldn't have been approved"
assert Topic.find(2).approved?, "Second should still be approved"
end
def test_code_after_rollback_should_not_be_executed
Topic.transaction do |transaction|
@first.approved = true
@first.save
transaction.rollback!
fail "code after rollback should not be executed"
end
assert @first.approved?, "First should still be changed in the objects"
assert !Topic.find(1).approved?, "First shouldn't have been approved"
end
--
Alex
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---