I’ve been using Shoulda for a while. And for my current project, I decided to go fixtureless with Shoulda + Factory Girl. All good, except one problem. Slow as fuck tests. So here’s fast_context as a solution for it. fast_context compiles all the ‘should’s within a context into a single test.
For example :
1 2 3 4 5 6 7 8 9 10 11 |
class UsersControllerTest < ActionController::TestCase fast_context "#new" do setup do @user = Factory(:user) get :new end should_render_template :new should_render_with_layout :users end end |
This will be compiled into something like :
1 2 3 4 5 6 7 8 |
class UsersControllerTest < ActionController::TestCase test "test: #new should run_fast" @user = Factory(:user) get :new should_render_template :new should_render_with_layout :users end end |
As your setup method just once per fast_context, the tests run much faster.
To install :
script/plugin install git://github.com/lifo/fast_context.git |
This was a result of a short time of hacking. So there may be bugs. Please comment here if you run into any issues.






