absurdly slow running rspec test

◇◆丶佛笑我妖孽 提交于 2020-01-14 06:13:43

问题


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

Gemfile

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

回答1:


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?



来源:https://stackoverflow.com/questions/22993364/single-short-rspec-test-takes-80-seconds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!