Commit message below should explain my reasoning. Turns out catching and not re-raising exceptions during release_savepoint was hiding exceptions triggered by after_commit callbacks during testing. I think this commit fixes everything, but I admit, I wasn't a 100% sure the changes I made were in sync with your transaction pointer state.
When an exception is caused during a 'release_savepoint' call, after handling the error, activerecord re-raises so outer code has a chance to see the error. However, active_callback was acting as a sink, catching exceptions and not re-throwing to prevent active record from triggering a rollback on
an already committed savepoint. This submission makes an attempt to save commit progress in a non-transient manner, so exceptions can be passed to active record while allowing rollbacks to be skipped if a savepoint has already been released. The immediate benefit are unit/functional tests
properly reporting errors that occur during after_commit callbacks triggered during a release_savepoint call.
Given I'm not using this any more (I only used it for Thinking Sphinx, and generally developing on Rails 3 these days), am happy to bow to your wisdom on whether it's working correctly or not.
Commit message below should explain my reasoning. Turns out catching and not re-raising exceptions during release_savepoint was hiding exceptions triggered by after_commit callbacks during testing. I think this commit fixes everything, but I admit, I wasn't a 100% sure the changes I made were in sync with your transaction pointer state.
When an exception is caused during a 'release_savepoint' call, after handling the error, activerecord re-raises so outer code has a chance to see the error. However, active_callback was acting as a sink, catching exceptions and not re-throwing to prevent active record from triggering a rollback on an already committed savepoint. This submission makes an attempt to save commit progress in a non-transient manner, so exceptions can be passed to active record while allowing rollbacks to be skipped if a savepoint has already been released. The immediate benefit are unit/functional tests properly reporting errors that occur during after_commit callbacks triggered during a release_savepoint call.