- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 RSpec 进行 Rails 3 测试并尝试使用 Spork。
我遵循了几个教程,Spork 似乎没有错误地运行,但是我的测试在打开和关闭 Spork 的情况下仍然需要相同的时间来运行(43 秒)。
我怎样才能弄清楚发生了什么?
文件
gem 'spork', '>=0.9.0.rc9'
require 'rubygems'
require 'spork'
require 'factory_girl'
require 'cover_me'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
# if you change any configuration or code from libraries loaded here, you'll
# need to restart spork for it take effect.
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
# Force find of factory girl definitions. Tests started failing without this, and the factories could not be found
Factory.find_definitions
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# == Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
#
# config.mock_with :mocha
# config.mock_with :flexmock
# config.mock_with :rr
config.mock_with :rspec
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# Needed for Spork
ActiveSupport::Dependencies.clear
end
end
Spork.each_run do
# This code will be run each time you run your specs.
end
最佳答案
这取决于您如何衡量执行时间。如果您将启动 rails 所需的时间包括在内,则该时间应该更快,但实际测试运行时间不会改变。
Spork 缓存了 rails 环境,这会加快启动时间,但不会加快实际执行时间。
关于ruby-on-rails - Spork 没有加速我的测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6618153/
每当我运行 spork 时,我都会得到 $ spork Using RSpec Preloading Rails environment Loading Spork.prefork block...
我关注了 "How I Test" screencast at RailsCasts ,但是我遇到了 spork 的问题 $ guard Guard is now watching at '/User
当我用 spork 运行我的 rspec 测试时,每次我使用 capybara 的 save_and_open_page 时,spork 都会丢失测试套件......或者可能不再输出任何东西.....
我按照 Michael Hartl 的 Rails 教程使用 Spork 运行 Guard,我遇到了这个问题。以下是错误信息: 20:45:58 - INFO - Starting Spork for
如果我在我的 rails 项目中使用 spork 并且有一个像这样的 spec_helper.rb 文件 require 'spork' Spork.prefork do ... end Spor
我现有的 rspecs 和 Cucumber 功能都运行良好。 我正在安装 spork(实际上是 spork-rails)以提高重新运行速度。 我有 spork 的 rspec 运行良好。 我刚刚按照
我花了好几个小时试图配置 spork,以便它适用于 RSpec,适用于 Cucumber,重新加载模型,以便它不必一直重新启动并且不会抛出错误。 我花了很多时间研究其怪癖的解决方案,以至于我可能只是等
我有一个 spork gem 问题。每次运行 spork 命令时,都会出现这个长错误: evan@TheBeast-Computer:~/rails_projects/sample_app$ spor
我正在使用以下 gem 和 ruby-1.9.3-p194 : rails 3.2.3 rspec-rails 2.9.0 spork 1.0.0rc2 guard - pig 肉 0.6.1 此 G
我使用 spork 作为我的 DRB 和 autotest 作为我的观察者来加速我的 Rails 应用程序中的测试。目前,autotest 会在目录结构中的文件 发生更改时重新启动测试。 有没有办法在
我整天都在使用spork,在大多数情况下,这确实很棒。 但是,我经常遇到一些问题,需要重新启动Spork才能通过测试...现在,我想知道这是否比它值得的麻烦更多。我是ruby的新手,所以有时我无法预测
我正在使用 RSpec 进行 Rails 3 测试并尝试使用 Spork。 我遵循了几个教程,Spork 似乎没有错误地运行,但是我的测试在打开和关闭 Spork 的情况下仍然需要相同的时间来运行(4
我使用 spork 和 guard 来加速我的 Rails 3.2 应用程序中的测试套件。然而,在添加新迁移后,guard 中的测试表现得很奇怪:它们的行为就像它们不知道架构中的变化一样,即使我之前运
谁能解释一下如何将 Spork 与 Minitest 一起使用。我看到有一个 spork-minitest gem , 但不清楚如何使用它。 最佳答案 将其添加到 Gemfile 后,您可以使用 ht
因此,在 Rails 3.0.9 应用程序上,我在 1.9.2 上使用了 Spork/Guard/RSpec/FactoryGirl。 我想知道如何让 Spork/Guard 自动更新我的工厂和语言环
我正在按照 http://ruby.railstutorial.org/ 上的教程开发我的第一个 Rails 应用程序.我已经完全按照教程中的说明设置了我的开发环境(我正在使用带有 Lion 的 Ma
我正在使用以下技巧(来自 http://mikbe.tk/2011/02/10/blazingly-fast-tests/ )来确保在每次使用 Spork 运行 RSpec 时重新加载模型: Spor
使用Spork时如何加载Machinist的蓝图? gem : mongoid (2.0.0.rc.6) capybara (0.4.1.1) 牛排 (1.1.0) spork (0.9.0.rc2)
我正在尝试使用 spork 加速 Rails 2.3.8 应用程序中的“rspecing”。当我在项目的根目录中运行 spork 时,我得到: (...stuff...) No server is r
我在命令行上运行 spork --bootstrap 并收到错误 -bash: spork: command not found 我知道我已经安装了 spork,因为当我运行 bundle show
我是一名优秀的程序员,十分优秀!