2013-08-31 64 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' 

的你的问题的根源。

相关问题