[rspec-users] Setting use_transactional_fixtures=false for a single spec - a bad idea?

David Chelimsky dchelimsky at gmail.com
Fri Aug 31 11:19:44 EDT 2007


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
>


More information about the rspec-users mailing list