运行 rspec 测试异常缓慢 [英] absurdly slow running rspec test
本文介绍了运行 rspec 测试异常缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个非常简单和简短的测试,需要 80 秒才能运行,有什么关于加快速度的建议吗?
I have this very simple and short test which takes a 80 seconds to run, any advice on speed it up?
require 'spec_helper'
describe "Battles" do
let(:character) { (FactoryGirl.create :character) }
describe "Battle button" do
it "redirects to battle screen" do
character.init("fighter")
click("Battle")
expect(page).to have_content character.name
end
end
end
宝石文件
source 'https://rubygems.org'
ruby '2.0.0'
gem 'pg', '0.15.1'
gem 'rails', '4.0.2'
gem 'bcrypt-ruby', '~> 3.1.2'
gem 'twitter-bootstrap-rails'
gem 'therubyracer'
gem 'devise'
gem 'less-rails'
gem 'will_paginate', '~> 3.0'
gem 'heroku'
group :development, :test do
gem 'rspec-rails', '2.13.1'
gem 'better_errors'
gem 'binding_of_caller'
gem 'factory_girl'
gem 'guard-rspec'
gem 'guard-spork'
gem 'capybara', '2.1.0'
gem 'factory_girl_rails', :require => false
gem 'spork-rails'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
end
group :production do
gem 'rails_12factor', group: :production
end
#gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
推荐答案
您可以尝试使用 Zeus 来加快速度.
You can try to use Zeus to speed things up.
你有很多测试,只有这个是唯一慢的还是只有这个测试?
Do you have a lot of tests and this one is the only slow one or do only have this test?
您的其余配置看起来如何?
How does the rest of your configuration look?
这篇关于运行 rspec 测试异常缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文