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

时间:2011-02-03 00:55:01

标签: rspec gem autotest

我正在尝试在终端中运行命令'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的gem。我的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

有关如何解决这个问题的想法吗?

2 个答案:

答案 0 :(得分:3)

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

答案 1 :(得分:0)

Trenton我解决了这个问题,将所有gems可执行文件放在带有bundle install --binstubs的/ bin下,并在 Gemfile 中包含growl。我不知道为什么autotest gem在执行gem install autotest后没有创建任何可执行文件。你在哪个目录中拥有该可执行文件?