自动测试:APP:无法运行测试
我的自动测试有问题。似乎时而进时而出,这很奇怪。它工作正常,然后开始发出咆哮消息应用程序:无法运行测试。
我不得不乱搞一段时间才能让自动测试工作,但它看起来真的很不稳定。我是 Rails 新手,所以我确信我做错了什么。
我已经在寻找答案,并且运行 autotest -s rspec2
似乎也不起作用(我在 cd 进入应用程序目录时键入)。
每次运行测试(保存文件)时,我都会得到以下结果:
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:inrequire': 没有要加载的文件 -- 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' 来自/Users/userx/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb:1 来自 /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
load' 来自 /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in load_spec_files' 来自 /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' 来自 /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:18:in
run' 来自 /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in run_in_process' 来自 /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:46:in
run' 来自 /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:10:in autorun' 来自 /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/bin/rspec:4
I've got a problem with autotest. It seems to drop in and out which is strange. It was working fine then started to shoot a growl message APP: Could Not Run Tests.
I had to mess around for a while to get autotest to work but it just seems really unstable. Im new to rails so I'm sure I'm doing something wrong.
I've dug around for an answer already and running autotest -s rspec2
doesnt seem to work either (I'm typing whilst cd'd into the app directory).
Every time I run a test (save a file) here's what I get:
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'
require': no such file to load -- spork (LoadError)
/Users/userx/rails_projects/sample_app/spec/spec_helper.rb:2:in
from /Users/userx/rails_projects/sample_app/spec/spec_helper.rb:2
from /Users/userx/rails_projects/sample_app/spec/controllers/pages_controller_spec.rb:1:in require'
load'
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
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in load_spec_files'
map'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/configuration.rb:387:in load_spec_files'
run'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:18:in
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in run_in_process'
run'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:46:in
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你安装了spork吗?从您的日志文件中:
Did you install spork? from your log file:
如果您正在运行 spork 并且 .rspec 文件中包含 --drb,则在 1.9.x 上可能会出现这种情况。我不知道为什么。
Spork 通常是可选的 - 它只会使测试运行得更快。
This can occur on 1.9.x if you are running spork and have --drb in your .rspec file. I don't know why.
Spork is typically optional - it just makes test run faster.
这件事发生在我身上,让我绊倒了几个小时。如果您只是简单地尝试使用测试单元并让它在每次保存时运行测试并咆哮,请尝试使用 autotest-rails-pure 和 autotest-standalone:
按照此处的安装说明进行操作:https://github.com/grosser/autotest
This happened to me and tripped me up for a few hours. If you're simple trying to use Test Unit and have it run the test and growl every time you save, try using autotest-rails-pure and autotest-standalone:
Follow the install directions here: https://github.com/grosser/autotest