Well this is not true anymore. Why?
Because of this:
message type 0x54 arrived from server while idle message type 0x44 arrived from server while idle message type 0x43 arrived from server while idle message type 0x5a arrived from server while idle
From time to time I've experienced strange errors in my tests. They were failing, or there were strange errors (like that listed above) which caused RSpec to froze...
This was because of shared database connection. And I did not like it at all. So I've dropped shared connection at all.
But what is the better way?
It is database_cleaner. With this gem you can easily setup different database cleanup strategies for your tests.
For one of my projects I've just used this setup:
# spec/spec_helper RSpec.configure do |config| ... # set strategy and cleanup DB before running entire test suite config.before(:suite) do DatabaseCleaner.strategy = :truncation DatabaseCleaner.clean_with(:truncation) end config.before(:each) do DatabaseCleaner.start end config.after(:each) do DatabaseCleaner.clean end end
That's all! This setup is pretty simple, but you have much more possibilities.