1

我正在使用 Ruby on Rails 3.2.15,我想使用 spring 来加速我的开发。我正在使用警卫 1.7.0 和 rspec 2.13.1。

这是我的Guardfile

guard 'rspec', cmd: 'bundle exec spring rspec --color --fail-fast', all_on_start: false, keep_failed: false, all_after_pass: false, rubygems: false, bundler: false do
  watch(%r{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{app/(.+)/(.+)\.rb})                  { |m| "spec/#{m[1]}/#{m[2]}_spec.rb" }
  watch(%r{spec/(.+)/(.+)_spec\.rb})
end

spring-commands-rspec在我的 Gemfile 中添加了 gem:

group :development, :test do
  ...
  gem 'spring-commands-rspec'
end

bundle install编辑并创建了 binstubs ( bundle exec spring binstub --all),运行guard并保存了一个测试以便guard运行它。完成后,我检查了spring status,但它说Spring is not running

我修改了Guardfile删除rubygemsandbundler选项,甚至删除了bundle execcall incmd选项,但没有任何东西使 spring 运行。

任何想法?谢谢!

4

1 回答 1

0

首先,您可以将 RSpec 选项放在一个.rspec文件或.rspec-local这样的文件中:

--color
--fail-fast

这样,无论从哪里调用 rspec,都可以使用它们。

其次,使用 Guard 和 Spring 的最佳方式是确保 spring 首先在 guard外部正常工作,例如

spring stop
bin/rspec # if it was generated with spring binstub
spring status

如果这不起作用 - 也许它没有正确地被回收。RSpec 自己工作吗?(没有弹簧)。

如果这不起作用,请尝试此处的步骤:https ://github.com/rails/spring#troubleshooting

(万一春天因为其他原因没有开始)

于 2014-12-17T07:46:30.280 回答