I’ve got this issue with database locking when I’m testing some threading features I’ve got in my application–the database locks on one thread and then all the other threads deadlock on that. As there’s no explicit transaction in my code I can’t just guard and release manually.
I read somewhere that fixtures in TestCase leverage implicit (implicit to MY code) transactions to clean out the database between tests, but I can’t find anywhere if this is true for Factory Girl as well.
Does anyone know if it is true and if so, is there a way to turn it off for specific tests, but not all of the tests?
thanks in advance!
FactoryGirl just takes your model, sets the attributes, and calls #save on that model. I think you just need to change a setting. With RSpec, you should have a line in your spec_helper.rb file:
This config is sent to the Rails testing config. This is then used in the #setup_fixtures method.
The documentation on Rails transactional fixtures
HTH