I’m using RSpec in most of my recent projects. In fact, whatever new I start gets RSpec installed by default. Recently I began using Sorcery gem for authentication. It’s a small and non-intrusive solution that I find very well-fitted for how I do things. If you are using Sorcery, you may be glad to find out that it’s possible to make your whole functional testing suite almost twice as fast.
And without further ado… In your
need to add the following 3 lines:
if Rails.env.test? user.custom_encryption_provider = nil end
With these lines you disable password encryption. Default provider is
BCrypt, which (given the number of times it will be called during
testing with every user object creation) can take up to 50% of your testing
time. That exactly what’s happened to my tests.
Another small hint is if you are developing for Heroku and using Ruby 1.9.2 just because Heroku Cedar stack has it, consider using Ruby 1.9.3 locally. My tests became 60% faster after just switching to Ruby 1.9.3.