Reputation: 2011
I am running the following gems in a rails 3.1 app ontop of ruby 1.9.2:
group :test, :development do
gem 'turn', '<0.8.3'
gem 'rspec-rails'
gem 'capybara'
gem 'guard-rspec'
gem 'minitest'
gem 'ruby_gntp'
gem "win32console", "~> 1.3.0"
end
I have only initialized guard and rspec by running the
rails g integration_test MyApp
command.
so, I have only the one sample test that is generated by the command. it looks like this:
require 'spec_helper'
describe "Tasks" do
describe "GET /tasks" do
it "works! (now write some real specs)" do
# Run the generator again with the --webrat flag if you want to use webrat methods/matchers
get tasks_index_path
response.status.should be(200)
end
end
end
for some reason, when i run guard, it takes guard and rspec between 3.5 and 5 seconds just fail this on little test. On the tuts I've seen, their machine runs this exact test in about .0159 seconds on a Mac. What can I do to increase the performance of these test?
I am running this on a Windows 7 machine.
Has anyone dealt with this situation?
Upvotes: 0
Views: 592
Reputation: 2132
The one word answer to this question, as @jstim suggested above, is Spork.
At minimum, you'll want to add the following to your :test, :development
block:
gem 'spork', '~> 1.0rc'
gem 'guard-spork'
Here is a link to the Spork README.
What it does is sets up a preload block that you can put as much or as little of your app in as you like. The benefit, of course, is faster tests because of all that stuff that doesn't need to be run each time. The drawback is if you make changes to the stuff that's preloaded, it will not be tested. You need to restart Spork after such changes.
Upvotes: 1