[rspec-users] Testing transactional updates in story runner
jarkko at jlaine.net
Wed Nov 21 07:06:57 EST 2007
How do you guys test transactional updates with story runner?
I have an action that needs to update four different models:
The last update_attributes! will raise ActiveRecord::RecordNotValid
if anything was invalid (it cascades to contact and further to
addresses), and thus cause a rollback, so either all the updates go
through or none of them. This works fine in development and production.
However, in story runner the whole story is put inside a big
transaction and further attempts to create or rollback transactions
are ignored. This is of course nice from the performance point of
view, but if you have code that depends on actual transactions in the
app, you're screwed. In my example the addresses would stay updated
in the story runner's eyes even though in real life the changes would
be rolled back, thus making stories not what they're supposed to be,
end-to-end tests for the application stack.
Has anyone found an elegant way to circumvent this with story runner?
More information about the rspec-users