If you relay heavily in cucumber for your integration and/or acceptance tests, it can quite easily grow out of your reach, thus making necessary to improve running time of tests. One of the best techniques that can lower your testing times is running cucumber in headless mode.
Posts from ‘October, 2011’
Customizing devise routes
I was reading through the devise gem source trying to learn something and I came across this: http://rdoc.info/github/plataformatec/devise/master/ActionDispatch/Routing/Mapper
It is like a bag of tricks for customizing the routes generated by devise, where you can pass a lot of ‘hidden’ options to the devise_for helper. I found specially nice these:
On testing resque
Some times it is hard to configure or slow to execute our resque queues in the testing environment. In those cases, we can use the monkeypatching ability of ruby to directly execute the jobs and by-pass the workers. Put this wherever you like but make sure to load it (in spec/support or features/support or config/initializers..):
resque_hack.rb
Quick tip in testing devise
If you are testing Devise and want a little more speed if you are creating lots of users in your tests, put this into config/initializers/devise.rb:
config.stretches = Rails.env.test? ? 1 : 10
Also, if you are having problems with the sign_out route and testing, maybe it could help to make it a GET route (instead of a DELETE one) whilst testing:
Quick trick to improve testing time w/ sqlite, cucumber & rspec in rails
For the average rails developer is quite common to use sqlite as a development and testing database, because it is quick to start using and has little system overhead, but it performs horribly. A nice and quick way to improve the overall speed is to put in memory the sqlite database, so the bottleneck is removed. We have improved our cucumbers from 12m to 3m!
Metrics: rules of thumb
Here are some typical numbers you can use to save yourself spreadsheet and research time: