2013-08-31 101 views
0

我正在使用Michael Hartl的Rails教程手冊,我在Chapter 3上,試圖讓rspec測試失敗,正如本書所述。唯一的問題是我保持我每次運行時得到一個加載錯誤: $包的exec rspec的投機/請求/ static_pages_spec.rb第3章Rails教程中的rspec loaderrror問題教程

它返回:

atlas:sample_app Leopard$ bundle exec rspec spec/requests/static_pages_spec.rb 
/usr/local/rvm/gems/[email protected]_rails_4_0/gems/selenium-webdriver- 2.0.0/lib/selenium/webdriver/common/zipper.rb:1:in `require': cannot load such file -- zip/zip (LoadError) 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver/common/zipper.rb:1:in `<top (required)>' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver/common.rb:9:in `require' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver/common.rb:9:in `<top (required)>' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver.rb:29:in `require' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver.rb:29:in `<top (required)>' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium-webdriver.rb:1:in `require' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium-webdriver.rb:1:in `<top (required)>' 
from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require' 
from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require' 
from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each' 
from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require' 
from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each' 
from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require' 
from /usr/local/rvm/gems/[email protected]/gems/bundler-1.3.5/lib/bundler.rb:132:in `require' 
from /Users/Leopard/Autodidactism/Rails Tutorial/sample_app/config/application.rb:12:in `<top (required)>' 
from /Users/Leopard/Autodidactism/Rails Tutorial/sample_app/config/environment.rb:2:in `require' 
from /Users/Leopard/Autodidactism/Rails Tutorial/sample_app/config/environment.rb:2:in `<top (required)>' 
from /Users/Leopard/Autodidactism/Rails Tutorial/sample_app/spec/spec_helper.rb:3:in `require' 
from /Users/Leopard/Autodidactism/Rails Tutorial/sample_app/spec/spec_helper.rb:3:in `<top (required)>' 
from /Users/Leopard/Autodidactism/Rails Tutorial/sample_app/spec/requests/static_pages_spec.rb:1:in `require' 
from /Users/Leopard/Autodidactism/Rails Tutorial/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run' 
from /usr/local/rvm/gems/[email protected]_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun' 

我也已經沖刷一切的這個問題的問題,但沒有給出的答案似乎對我有用。我一直被困約4小時。

我也重新安裝了rspec,確保我的Gemfile已保存並正確更新和安裝,並且仍然顯得無處可尋。

這裏是我當前的Gemfile:

source 'https://rubygems.org' 
ruby '2.0.0' 
#ruby-gemset=railstutorial_rails_4_0 

gem 'rails', '4.0.0' 
gem 'bootstrap-sass', '2.3.2.0' 
gem 'bcrypt-ruby', '3.0.1' 
gem 'faker', '1.1.2' 
gem 'will_paginate', '3.0.4' 
gem 'bootstrap-will_paginate', '0.0.9' 

group :development, :test do 
    gem 'sqlite3', '1.3.7' 
    gem 'rspec', '2.13.0' 
    gem 'rspec-rails', '2.13.1' 
    # The following optional lines are part of the advanced setup. 
    # gem 'guard-rspec', '2.5.0' 
    # gem 'spork-rails', github: 'sporkrb/spork-rails' 
    # gem 'guard-spork', '1.5.0' 
    # gem 'childprocess', '0.3.6' 
end 

group :test do 
    gem 'selenium-webdriver', '2.0.0' 
    gem 'rspec-rails', '2.13.1' 
    gem 'capybara', '2.1.0' 
    gem 'factory_girl_rails', '4.2.0' 
    gem 'cucumber-rails', '1.4.0', :require => false 
    gem 'database_cleaner', github: 'bmabey/database_cleaner' 

    # Uncomment this line on OS X. 
    # gem 'growl', '1.0.3' 

    # Uncomment these lines on Linux. 
    # gem 'libnotify', '0.8.0' 

    # Uncomment these lines on Windows. 
    # gem 'rb-notifu', '0.0.4' 
    # gem 'win32console', '1.3.2' 
end 

    gem 'sass-rails', '4.0.0' 
    gem 'uglifier', '2.1.1' 
    gem 'coffee-rails', '4.0.0' 
    gem 'jquery-rails', '2.2.1' 
    gem 'turbolinks', '1.1.1' 
    gem 'jbuilder', '1.0.2' 

group :doc do 
    gem 'sdoc', '0.3.20', require: false 
end 

group :production do 
    gem 'pg', '0.15.1' 
    gem 'rails_12factor', '0.0.2' 
end 

預先感謝您的幫助!

+0

可能需要更新gemfile中的selinium-webdriver?見http://stackoverflow.com/questions/18526392/ruby-on-rails-tutorial-section-3-2-rspec-testing-error – veritas1

+0

這樣做!非常感謝。它讓我堅持了一整天。 – lexgarey

回答

1

您需要更新您的gemfile。

gem 'selenium-webdriver', '2.0.0' 

gem 'selenium-webdriver', '~> 2.35.1' 

的你的問題的根源。

相關問題