It turns out, if I make the before(:each) block say this:

  before(:each) do
    @user = User.new
    controller.stub(:authenticate_user!)
    controller.stub(:current_user).and_return(@user)
    controller.stub(:add_secure_model_data)

    @site_update = SiteUpdate.new
    @comment = Comment.new
  end

All 3 tests now run in 0.07 seconds! That is a 2000% improvement.

I guess the solution is not to use factories at all for controller
tests.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to