我不能让自动测试工作。 Rspec工作正常。
首先,我无法使用bundle exec命令获取autotest / Rspec命令,因此我修改了Gemfile以包含以下代码。
source 'http://rubygems.org'
gem 'rails', '3.0.7'
gem 'sqlite3-ruby', '1.3.2', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.5.0'
end
group :test do
gem 'rspec', '2.5.0'
gem 'webrat', '0.7.1'
end
group :development, :test do
gem 'autotest'
end
然后我尝试安装自动测试,
$ [sudo] gem install autotest -v 4.4.6
我收到以下错误。
Successfully installed autotest-4.4.6
1 gem installed
Installing ri documentation for autotest-4.4.6...
File not found: lib
ERROR: While generating documentation for autotest-4.4.6
... MESSAGE: exit
... RDOC args: --ri --op /Library/Ruby/Gems/1.8/doc/autotest-4.4.6/ri --main README.txt lib History.txt Manifest.txt README.txt --title autotest-4.4.6 Documentation --quiet
随后我安装了咆哮和fsevent
$ [sudo] gem install autotest-rails-pure -v 4.1.2
$ [sudo] gem install autotest-fsevent -v 0.2.4
$ [sudo] gem install autotest-growl -v 0.2.9
已安装
我在根目录中修改了.autotest文件,
require 'autotest-growl'
require 'autotest-fsevent'
现在,当我尝试运行
时 $ bundle exec autotest
我收到以下错误。
loading autotest/rspec2
/Users/toad/.autotest:1:in `require': no such file to load -- autotest/growl (LoadError)
from /Users/toad/.autotest:1
from /Library/Ruby/Gems/1.8/gems/ZenTest-4.5.0/lib/autotest.rb:311:in `load'
from /Library/Ruby/Gems/1.8/gems/ZenTest-4.5.0/lib/autotest.rb:311:in `initialize'
from /Library/Ruby/Gems/1.8/gems/ZenTest-4.5.0/lib/autotest.rb:310:in `each'
from /Library/Ruby/Gems/1.8/gems/ZenTest-4.5.0/lib/autotest.rb:310:in `initialize'
from /Library/Ruby/Gems/1.8/gems/rspec-core-2.5.2/lib/autotest/rspec2.rb:11:in `initialize'
from /Library/Ruby/Gems/1.8/gems/ZenTest-4.5.0/lib/autotest.rb:241:in `new'
from /Library/Ruby/Gems/1.8/gems/ZenTest-4.5.0/lib/autotest.rb:241:in `run'
from /Library/Ruby/Gems/1.8/gems/ZenTest-4.5.0/bin/autotest:6
from /usr/bin/autotest:19:in `load'
from /usr/bin/autotest:19
我错过了什么?
答案 0 :(得分:1)
autotest-growl
是来自autotest
的单独宝石,因此您需要在Gemfile
中为其添加单独的条目:
gem 'autotest-growl'
Gemfile
也可能需要单独的autotest-fsevent
条目。