Reputation: 49057
I have just started doing TDD (and basically testing in general so bear with me). I am following The Rails Tutorial and I now have the following in the spec folder:
require 'spec_helper'
describe PagesController do
describe "GET 'home'" do
it "returns http success" do
get 'home'
response.should be_success
end
end
describe "GET 'contact'" do
it "returns http success" do
get 'contact'
response.should be_success
end
end
end
The whole process from when I tap the play button saying that I want to run the tests until it is done take 38.75 seconds!! The two tests take 6.0053 seconds. What is going on in Ruby-land?
I don't know yet if this is integration testing or unit testing but I read a post about making one directory with integration tests and another with unit tests. I am using RubyMine on a PC with Windows 7 and SSD. How can I do TDD if I have to wait 40 seconds each time I run the test?
Upvotes: 1
Views: 888
Reputation: 909
Its because every time you autotest or rspec test your Rails tests, it needs to load the entire Rails environment. One way to avoid re-loading the entire Rails environment for each test is to use Spork
Spork Railscasts by Ryan Bates
and a lot is covered about Rspec and how to set it up at:
Ruby On Rails Tutorial book by Michael Hartl
Upvotes: 2