[rspec-users] Verifying some understanding about manipulating DB data in before/after callbacks in RSpec

Wes Gamble weyus at att.net
Thu Nov 6 17:21:31 EST 2008


Stephen Eley wrote:
> On Thu, Nov 6, 2008 at 4:32 PM, Wes Gamble <weyus at att.net> wrote:
>   
>> Attempting to manipulate data directly in the DB in a before/after callback
>> doesn't make sense since those changes will not persist across tests because
>> of the transactionality implied by "self.use_transactional_fixtures = true".
>>  Is that correct?
>>
>> Anyway, what the heck are you writing where it's important that data
>> be reset "in a certain way?"  
Fair enough.  No, I was just forgetting that the tests are supposed to 
be implicitly independent of each other.

What happened here is that WATIR doesn't conform to this Test::Unit 
"rollback" contract, so we were committing changes in one test
that were then breaking other tests later.  Our attempt to remedy this 
mistake via a misbegotten after(:each) failed because of the transactional
fixtures.

We've since torn down that data via WATIR in the original test itself.

Wes


More information about the rspec-users mailing list