As far as I can tell, RSpec simply uses inherited TestCase capabilities for
transactions, including use_transactional_fixtures (it's config setting is
simply passed on) and likely uses_transaction.

I'm guessing you can do something like:

    uses_transaction :create
    it "should save message" do
        ...
    end

At least it gives no exception for me.

The TestCase logic is pretty simple- it skips transactional fixtures if the
method is in it's array, so I imagine it works.

If not, this shoulda ticket talks about the same need, with a patch that
integrates it into shoulda contexts. That might give some clues.
https://thoughtbot.lighthouseapp.com/projects/5807-shoulda/tickets/97

BTW- I happened to be watching your RubyConf2008 Testing Heresies talk
yesterday. Good talk.

Regards,
Nick

On Tue, May 5, 2009 at 4:29 PM, Francis Hwang <s...@fhwang.net> wrote:

> Sorry if this has been answered elsewhere, Google was not very helpful
> to me on this one. If I'm running a model spec and am one of those
> benighted souls who wants to hit the DB while doing so, is there a way
> for me to tell RSpec to skip transactions? In Test::Unit I can say
> "uses_transaction :test_should_do_something", but am not sure what the
> analogous thing would be in RSpec.
>
> Thanks in advance,
> Francis
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to