RSpec + Mac OS X 上的自动测试错误

发布于 2024-10-15 10:36:48 字数 1996 浏览 3 评论 0原文

我正在尝试在终端中运行命令“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦断已成空 2024-10-22 10:36:48

修好了!正确的命令是“autotest”,而不是“bundle exec autotest”。 'rspec spec/' 也有效。

Fixed it! The correct command is 'autotest', not 'bundle exec autotest'. 'rspec spec/' also works too.

逆夏时光 2024-10-22 10:36:48

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 execute gem install autotest. In which directory do you have that executable?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文