[rspec-users] Database clearing

2008-09-19 Thread Todd Tyree
I'm seeing something strange and was just wondering if someone can confirm my assumptions for me: I have user model with a number of specs: some of them use fixtures and some of them don't. Today, while talking someone through some specs that needed developming, I noticed that the fixtures alway

Re: [rspec-users] Database clearing

2008-09-19 Thread Todd Tyree
[EMAIL PROTECTED] <[EMAIL PROTECTED]>'}.should be_blank end end On Fri, Sep 19, 2008 at 2:22 PM, Todd Tyree <[EMAIL PROTECTED]> wrote: > I'm seeing something strange and was just wondering if someone can confirm > my assumptions for me: > > I have user model with

Re: [rspec-users] Database clearing

2008-09-19 Thread Todd Tyree
> Does your spec_helper file have this: > > Spec::Runner.configure do |config| > config.use_transactional_fixtures = true > end > Yes. > > Also, what versions of rspec and rails are you using? 1.1.4 and 2.1.0 Cheers, Todd ___ rspec-users mailing l

Re: [rspec-users] Database clearing

2008-09-19 Thread Todd Tyree
On Fri, Sep 19, 2008 at 3:42 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: > I don't know the exact mechanism, but if we want a table to be emply that > might have had fixtures loaded into it at some point, we delete_all in > before(). It seems to me that if you have fixtures, they would be loaded >

Re: [rspec-users] Database clearing

2008-09-19 Thread Todd Tyree
On Fri, Sep 19, 2008 at 5:34 PM, Pat Maddox <[EMAIL PROTECTED]> wrote: > No, that is not correct. Here's how transactional fixtures work: > > 1. Before all specs run, load the fixtures into the database > 2. Start a transaction. Run the first spec > 3. Rollback transaction > 4. Start another tr

Re: [rspec-users] Database clearing

2008-09-20 Thread Todd Tyree
> We have a few lines of code in our features steps/env.rb that does this > > 1. patch AR to stash each AR object created in an array > 2. in an After do block, call destroy on each of those objects. > > We can probably share if anyone would like to see this. > > Please! Best, Todd ___

Re: [rspec-users] Database clearing

2008-09-20 Thread Todd Tyree
Ok, here's what I've come up with on the spur of the moment (goes in spec_helper.rb): config.after(:each) do result = ActiveRecord::Base.connection.execute('SHOW TABLES;') while table = result.fetch_row # Or whatever you think is appropriate. next if table.index('schema_migrat