Peter Marklund
2007-Aug-31 15:13 UTC
[rspec-users] Setting use_transactional_fixtures=false for a single spec - a bad idea?
Hi! I would really like to find a way to allow me to write RSpec specifications for code that use database transactions. I know I can set config.use_transactional_fixtures = false in my spec_helper.rb. That works, and that''s great, but it will (I think) slow down my specs quite a bit. I would like to turn off transactional fixtures for just a single spec (describe), or even better, just a single example (it). I tried this: before(:all) do Spec::Runner.configure do |config| config.use_transactional_fixtures = false end end after(:all) do Spec::Runner.configure do |config| config.use_transactional_fixtures = true end end but that didn''t work. Or is setting use_transactional_fixtures=false on a global level really the way to go even if it slows you down? It certainly feels a lot cleaner and solid to me. Maybe I need more db stubbing. Thanks in advance for any pointers! Cheers Peter http://marklunds.com
David Chelimsky
2007-Aug-31 15:18 UTC
[rspec-users] Setting use_transactional_fixtures=false for a single spec - a bad idea?
On 8/31/07, Peter Marklund <peter_marklund at fastmail.fm> wrote:> Hi! > I would really like to find a way to allow me to write RSpec > specifications for code that use database transactions. I know I can set > > config.use_transactional_fixtures = false > > in my spec_helper.rb. That works, and that''s great, but it will (I > think) slow down my specs quite a bit. I would like to turn off > transactional fixtures for just a single spec (describe), or even > better, just a single example (it). I tried this: > > before(:all) do > Spec::Runner.configure do |config| > config.use_transactional_fixtures = false > end > end > > after(:all) do > Spec::Runner.configure do |config| > config.use_transactional_fixtures = true > end > end > > but that didn''t work. > > Or is setting use_transactional_fixtures=false on a global level > really the way to go even if it slows you down? It certainly feels a > lot cleaner and solid to me. Maybe I need more db stubbing. > > Thanks in advance for any pointers!I''d set up a separate folder for these specs and tweak the rake tasks to run those specs in a separate process, w/ its own spec_helper that sets config.use_transactional_fixtures to false.> > Cheers > > Peter > http://marklunds.com > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky
2007-Aug-31 15:19 UTC
[rspec-users] Setting use_transactional_fixtures=false for a single spec - a bad idea?
On 8/31/07, Peter Marklund <peter_marklund at fastmail.fm> wrote:> Hi! > I would really like to find a way to allow me to write RSpec > specifications for code that use database transactions. I know I can set > > config.use_transactional_fixtures = false > > in my spec_helper.rb. That works, and that''s great, but it will (I > think) slow down my specs quite a bit. I would like to turn off > transactional fixtures for just a single spec (describe), or even > better, just a single example (it). I tried this: > > before(:all) do > Spec::Runner.configure do |config| > config.use_transactional_fixtures = false > end > end > > after(:all) do > Spec::Runner.configure do |config| > config.use_transactional_fixtures = true > end > end > > but that didn''t work. > > Or is setting use_transactional_fixtures=false on a global level > really the way to go even if it slows you down? It certainly feels a > lot cleaner and solid to me. Maybe I need more db stubbing. > > Thanks in advance for any pointers!I''d set up a separate folder for these specs and tweak the rake tasks to run those specs in a separate process, w/ its own spec_helper that sets config.use_transactional_fixtures to false.> > Cheers > > Peter > http://marklunds.com > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Peter Marklund
2007-Sep-01 06:52 UTC
[rspec-users] Setting use_transactional_fixtures=false for a single spec - a bad idea?
> I''d set up a separate folder for these specs and tweak the rake tasks > to run those specs in a separate process, w/ its own spec_helper that > sets config.use_transactional_fixtures to false.Thanks for the quick reply David! Sounds like your solution would be fairly easy to set up. For now though I''m running all my specs with use_transactional_fixtures=false. Slowed my specs down from about 6 to 12 seconds. Cheers peter
Possibly Parallel Threads
- Canonical way to generate RSpec HTML report in Rails app
- Helper methods starting with should_ get picked up as examples?
- Rails 3 / RSpec 2 use_transactional_fixtures and after_commit
- rake spec:views no transaction error
- Migrating spec_helper with modifications