On Wed, May 6, 2009 at 9:47 AM, Nicholas Van Weerdenburg <vanwe...@gmail.com> wrote: > 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
Any thoughts on what uses_transaction wants as an argument? I can't help but feel like I've tried 10 combinations of ways to do this, and there's some 11th way that will be easy but I haven't thought to try. For context, my code doesn't even use transactions; it's using a 2nd DB connection to a slave DB, which will be different in some envs and not others. This seems to get tripped up by transactions since the master connection makes a change to the DB and the slave connection needs to see it right away. (Yes I know in production there are latency issues, that's acceptable in this case.) > BTW- I happened to be watching your RubyConf2008 Testing Heresies talk > yesterday. Good talk. Thanks! Francis _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users