2012-01-17 129 views
1

我升級到Rails 3.1.3Ruby 1.9.3(通過RVM)後,我無法正常運行自動測試。我不知道發生了什麼事情,但是當我打印:Rails - 無法運行自動測試

$ autotest 

它顯示奇怪的錯誤

loading autotest/rails_rspec2 
/Users/serg/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': cannot load such file -- autotest/fsevent (LoadError) 
    from /Users/serg/.rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require' 
    from /Users/serg/rails_projects_terminal/sample_app/.autotest:2:in `<top (required)>' 
    from /Users/serg/.rvm/gems/[email protected]/gems/ZenTest-4.6.2/lib/autotest.rb:315:in `load' 
    from /Users/serg/.rvm/gems/[email protected]/gems/ZenTest-4.6.2/lib/autotest.rb:315:in `block in initialize' 
    from /Users/serg/.rvm/gems/[email protected]/gems/ZenTest-4.6.2/lib/autotest.rb:314:in `each' 
    from /Users/serg/.rvm/gems/[email protected]/gems/ZenTest-4.6.2/lib/autotest.rb:314:in `initialize' 
    from /Users/serg/.rvm/gems/ruby-1.9.3-head/gems/rspec-core-2.8.0/lib/autotest/rspec2.rb:13:in `initialize' 
    from /Users/serg/.rvm/gems/ruby-1.9.3-head/gems/rspec-rails-2.8.0/lib/autotest/rails_rspec2.rb:31:in `initialize' 
    from /Users/serg/.rvm/gems/[email protected]/gems/ZenTest-4.6.2/lib/autotest.rb:244:in `new' 
    from /Users/serg/.rvm/gems/[email protected]/gems/ZenTest-4.6.2/lib/autotest.rb:244:in `run' 
    from /Users/serg/.rvm/gems/[email protected]/gems/ZenTest-4.6.2/bin/autotest:6:in `<top (required)>' 
    from /Users/serg/.rvm/gems/[email protected]/bin/autotest:19:in `load' 
    from /Users/serg/.rvm/gems/[email protected]/bin/autotest:19:in `<main>' 

但是當我嘗試:

bundle exec autotest 

它的工作原理。我該如何解決它?

我的Gemfile:

source 'http://rubygems.org'            

gem 'rails', '3.1.3'              
gem 'gravatar_image_tag'             
gem 'will_paginate'              
gem 'rack'                
gem 'texticle', "2.0", :require => 'texticle/rails'      


group :assets do               
    gem 'sass-rails'              
    gem 'coffee-rails'              
    gem 'uglifier'               
end                  

gem 'jquery-rails'              

group :development do             
    gem 'rspec-rails'              
    gem 'therubyracer-heroku'            
    gem 'pg'                
    gem 'annotate', :git => 'git://github.com/ctran/annotate_models.git'               
    gem 'faker'               
end                  

group :test do               
    gem 'rspec-rails'              
    gem 'webrat'               
    gem 'spork'               
    gem 'autotest'               
    gem 'autotest-rails-pure'            
    gem 'autotest-fsevent'             
    gem 'autotest-growl'             
    gem 'factory_girl_rails'            
end                  

group :production do              
    gem 'pg'                
end                  

回答

4

我解決它。我找到了這個網頁:http://www.viget.com/extend/how-why-to-run-autotest-on-your-mac/ ,然後我打印在終端:

$ gem update ZenTest 
$ gem cleanup ZenTest 
$ gem install autotest-fsevent 

之後自動測試開始正常工作。

+0

如果您在使用'bundler',你得把'自動測試,fsevent'在'Gemfile'爲好。 – 2014-06-18 18:16:05

5

我有這樣的問題,以及,解決它,我不得不做的你做了什麼:

$ gem update ZenTest 
$ gem cleanup ZenTest 
$ gem install autotest-fsevent 

但我也不得不添加「自動測試,咆哮」和「自動測試-fsevent」我的Gemfile ,現在看起來是這樣的:

group :development do 
    gem 'sqlite3' 
    gem 'rspec-rails' 
    gem 'autotest' 
    gem 'ZenTest' 
    gem 'autotest-growl' 
    gem 'autotest-fsevent' 
end 

然後

$ Bundle install 

現在

$ autotest 

作品就好:)