我遇到了自动测试的问题。它似乎是悄悄进出,这很奇怪。它工作正常然后开始发出咆哮消息 APP:无法运行测试。
我不得不乱搞一段时间才能让自动测试工作,但它似乎真的很不稳定。我是铁杆新手所以我确定我做错了什么。
我已经挖了一个答案,并且autotest -s rspec2
似乎也没有工作(我正在键入app app目录)。
每次我运行测试(保存文件),这就是我得到的:
bundle exec /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -S /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/bin/rspec --tty '/Users/userx/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb'
/Users/userx/rails_projects/sample_app/spec/spec_helper.rb:2:in
要求':没有要加载的文件 - spork(LoadError)
来自/Users/userx/rails_projects/sample_app/spec/spec_helper.rb:2
来自/Users/userx/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb:1:in require'
from /Users/userx/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb:1
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
load'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in load_spec_files'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
map'
来自/Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in load_spec_files'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:18:in
run'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in run_in_process'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:46:in
run'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:10:in autorun'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/bin/rspec:4
答案 0 :(得分:0)
你安装了spork吗?来自您的日志文件:
require': no such file to load -- spork
答案 1 :(得分:0)
如果您正在运行spork并且在.rspec文件中包含--drb,则可能会在1.9.x上发生这种情况。我不知道为什么。
Spork通常是可选的 - 只是让测试运行得更快。
答案 2 :(得分:0)
这件事发生在我身上,让我吵了几个小时。如果您只是想简单地尝试使用测试单元并让它在每次保存时运行测试并咆哮,请尝试使用autotest-rails-pure和autotest-standalone:
按照此处的安装说明进行操作:https://github.com/grosser/autotest