RSpec + Mac OS X 上的自动测试错误
我正在尝试在终端中运行命令“bundle exec autotest”。如果我使用“bundle exec rspec spec/”,我可以让 RSpec 工作,但我无法运行自动测试(第一个命令)。不幸的是,我收到以下错误:
Trenton-Scotts-MacBook-Air:sample_app TTS$ bundle exec autotestloading autotest/rails_rspec2
/Users/TTS/Documents/Rails/sample_app/.autotest:1:in `require': no such file to load -- autotest/growl (LoadError)
from /Users/TTS/Documents/Rails/sample_app/.autotest:1:in `<top (required)>'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:305:in `load'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:305:in `block in initialize'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:304:in `each'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:304:in `initialize'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/autotest/rspec2.rb:10:in `initialize'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-rails-2.4.1/lib/autotest/rails_rspec2.rb:31:in `initialize'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:236:in `new'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:236:in `run'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/bin/autotest:7:in `<top (required)>'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/bin/autotest:19:in `load'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/bin/autotest:19:in `<main>'
我的 Rails 项目文件夹中的 .autotest 中有两行:
require 'autotest/growl'
require 'autotest/fsevent'
我安装了 autotest-growl 和 autotest-fsevent 的 gems。我的 Gemfile 看起来像这样:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development do
gem 'autotest'
gem 'rspec-rails', '2.4.1'
end
group :test do
gem 'rspec', '2.4.0'
gem 'webrat', '0.7.1'
end
关于如何解决这个问题有什么想法吗?
I'm trying to run the command 'bundle exec autotest' in Terminal. I can get RSpec working if I use 'bundle exec rspec spec/', but I can't get autotest (the first command) running. Unfortunately, I get the following error:
Trenton-Scotts-MacBook-Air:sample_app TTS$ bundle exec autotestloading autotest/rails_rspec2
/Users/TTS/Documents/Rails/sample_app/.autotest:1:in `require': no such file to load -- autotest/growl (LoadError)
from /Users/TTS/Documents/Rails/sample_app/.autotest:1:in `<top (required)>'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:305:in `load'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:305:in `block in initialize'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:304:in `each'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:304:in `initialize'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-core-2.4.0/lib/autotest/rspec2.rb:10:in `initialize'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/rspec-rails-2.4.1/lib/autotest/rails_rspec2.rb:31:in `initialize'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:236:in `new'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/lib/autotest.rb:236:in `run'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/gems/ZenTest-4.4.2/bin/autotest:7:in `<top (required)>'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/bin/autotest:19:in `load'
from /Users/TTS/.rvm/gems/ruby-1.9.2-p136/bin/autotest:19:in `<main>'
I have two lines in .autotest in my Rails project folder:
require 'autotest/growl'
require 'autotest/fsevent'
I installed the gems for autotest-growl and autotest-fsevent. My Gemfile looks like this:
source 'http://rubygems.org'
gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'
group :development do
gem 'autotest'
gem 'rspec-rails', '2.4.1'
end
group :test do
gem 'rspec', '2.4.0'
gem 'webrat', '0.7.1'
end
Any thoughts on how to fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
修好了!正确的命令是“autotest”,而不是“bundle exec autotest”。 'rspec spec/' 也有效。
Fixed it! The correct command is 'autotest', not 'bundle exec autotest'. 'rspec spec/' also works too.
Trenton 我解决了这个问题,将所有 gems 可执行文件放在 /bin 下,使用
bundle install --binstubs
并在 Gemfile 上包含咆哮。我不知道为什么 autotest gem 在执行gem install autotest
后没有创建任何可执行文件。您在哪个目录中有该可执行文件?Trenton I solved that issue putting all gems executables under /bin with
bundle install --binstubs
and including growl on Gemfile. I don't know why autotest gem did not created any executable after executegem install autotest
. In which directory do you have that executable?