我正在尝试在带有 spork 的 rails 2.3.8 应用程序中加速“rspecing”。当我在项目的根目录中运行 spork 时,我得到:
(...stuff...)
No server is running
Running specs locally:
Spork is ready and listening on 8989!
然后,如果我运行规范,消息
No server is running
Running specs locally
如果我在没有 Spork 的情况下运行它们,就会出现这种情况,但是规范启动与没有 Spork 的情况一样慢。同样在 Spork 的终端中,没有进一步的输出出现。
我的问题是,spork 真的在运行吗?如果是这样,规范是否在那里运行?最后,如果两者的答案都是正确的,我该如何加快测试速度?
以下是涉及的配置文件:
规格/规格.opts
--colour
--format progress
--loadby mtime
--reverse
--drb
规范/规范.helper
require 'rubygems'
require 'bundler/setup'
require 'spork'
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))
require 'spec/autorun'
require 'spec/rails'
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
Spec::Runner.configure do |config|
end
end
Spork.each_run do
end
而且,要问一个完整的问题,这里是用“时间”衡量的时间:
带叉叉:
real 0m39.524s
user 0m5.012s
sys 0m0.912s
没有Spork:
real 0m39.576s
user 0m18.537s
sys 0m2.400s
跑步时--诊断我得到
- Spork Diagnosis -
-- Summary --
config/boot.rb
config/initializers/inflections.rb
config/initializers/mime_types.rb
config/initializers/new_rails_defaults.rb
config/initializers/site_keys.rb
config/preinitializer.rb
spec/spec_helper.rb
然后,对于
--- config/initializers/inflections.rb ---
--- config/initializers/mime_types.rb ---
--- config/initializers/new_rails_defaults.rb ---
--- config/initializers/site_keys.rb ---
以下堆栈跟踪
/var/lib/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:147:in `load'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:622:in `load_application_initializers'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:621:in `each'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:621:in `load_application_initializers'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:176:in `process'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `send'
/var/lib/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in `run_without_spork'
/var/lib/gems/1.8/gems/spork-0.8.4/lib/spork/app_framework/rails.rb:18:in `run'
config/environment.rb:15
spec/spec_helper.rb:14:in `require'
spec/spec_helper.rb:14
/var/lib/gems/1.8/gems/spork-0.8.4/bin/../lib/spork.rb:23:in `prefork'
规格/spec_helper.rb:6