Reputation: 4742
My spec (only 1 test) was taking about 40 seconds to run with rspec. I have spork running now and it did cut the time to about 17 seconds, but that still seems to be a little ridiculous for only 1 test. I am on an AMD Athlon II X2 250 3.0GHz processor, Ubuntu 11.04, 4GB RAM. The processor does look like it hits 100% on both cores for a brief period while running the tests. Does this all sound normal or have is there something weird going on?
Additionally, when running this through Guard, the timer never resets. So the first test reports 17 seconds, then if I wait 15 seconds before starting the next test, 17 seconds later it will report that the second test took 49 seconds (17 for the first + 15 in between + 17 for the second). Is this normal?
describe "CompanyCustomers" do
it "allows creation of new customers" do
visit new_company_customer_path
fill_in "company_customer_first_name", :with => "John"
fill_in "company_customer_last_name", :with => "Doe"
click_button("Save")
page.should have_content("John Doe")
end
end
Upvotes: 0
Views: 448
Reputation: 16197
This will fix the timer, until the Guard or RSpec team fixes that.
Spork.each_run do
$rspec_start_time = Time.now
end
And no, that's way too much time for one single test. Use that code and let me know if the time seems more real.
If it is still over 10 seconds you should try to mimic what you do in code in real. Do it yourself in the browser. Does it take so such a long time for the controllers to respond? Maybe you need to optimise there.
If not, then show us your spec_helper.
Upvotes: 4