Guard,Spork,Rspec和Rails的问题3

Mik*_*ike 25 rspec ruby-on-rails guard spork ruby-on-rails-3

我跟着spork railscast视频,当我试图守卫时,它给了我以下错误:

Guard is now watching at '/Users/m/work/'
Starting Spork for Test::Unit & RSpec 
Couldn't find a supported test framework that begins with 'testunit'

Supported test frameworks:
( ) Cucumber
(*) RSpec

Legend: ( ) - not detected in project   (*) - detected
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
--> ERROR: Could not start Spork server for Test::Unit & RSpec. Make sure you can use it manually first.
Guard::RSpec is running, with RSpec 2!
Running all specs
Run Code Online (Sandbox Code Playgroud)

它看起来像spork服务器启动正常,然后错误,并试图继续.我尝试过:等待选项120秒,它仍然有同样的问题.

如果我执行没有防护和防护装置的测试,Spork工作正常

环境:

  • Mac OSX
  • 铁轨(3.1.1)
  • 后卫(0.8.8)
  • guard-rspec(0.5.4)
  • spork(0.9.0.rc9)
  • 警卫队(0.3.1)

我该如何调试此问题?我不知道从哪里开始.

jam*_*esc 76

我在Ubuntu上遇到了这个问题.我的解决方案很简单:

1)我停止了警惕

2)我删除了测试文件夹

3)开始守卫

这一次,我没有看到Begin Spork for Test :: Unit和RSpec,而是为RSpec开始Spork.所以spork自动识别出我的测试文件夹不再需要了,一切都运行得很好.

有趣的是

Supported test frameworks:
( ) Cucumber
(*) RSpec
Run Code Online (Sandbox Code Playgroud)

消息也消失了,我按照railscast获得了预期的结果.

我能想出的唯一结论是:

1)这不是依赖于操作系统的问题.

2)spork,rspec和测试单元在Rails> v3.x应用程序上不能很好地发挥作用.你不需要两者.更新 - 如果您需要,请参阅下面的更新答案.

显然,我非常密切地遵循Railscast指令,但我认真建议您删除测试文件夹.

更新 应该注意的是,根据以下来自@yuvilio的评论,可以让两者很好地一起玩,其引用如下:

我不认为问题在于他们不相处.我让Cucumber/Rspec/testunit在spork中互相玩得很好.在我的gemfile中,除了rspec/cucumber/guard相关的宝石之外,我还添加了spork-testunit,guard-test,ruby-prof gems并运行了bundle install.然后,我引导testunit:bundle exec spork testunit --bootstrap.然后自定义test/test_helper.rb.然后更新了监视testunit的保护文件:bundle exec guard init test.当我守卫时,我获得了包括Spork服务器的输出,用于RSpec,Cucumber,Test :: Unit成功启动

  • 你的解决方案是有道理的,但我不认为问题是他们不相处.我让Cucumber/Rspec/testunit在spork中互相玩得很好.在我的gemfile中,除了rspec/cucumber/guard相关的宝石之外,我还添加了spork-testunit,guard-test,ruby-prof gems并运行了`bundle install`.然后,我引导testunit:`bundle exec spork testunit --bootstrap`.然后定制test/test_helper.rb.然后更新了监视testunit的保护文件:`bundle exec guard init test`.当我守卫时,我得到了输出,包括用于RSpec的Spork服务器,Cucumber,Test :: Unit成功启动了. (3认同)

小智 17

如果您不想删除测试文件夹,只需告诉guard忽略它:

guard 'spork', test_unit: false do
  # ...
end
Run Code Online (Sandbox Code Playgroud)