4

recently started the RoRTute by Michael Hartl, getting stuck trying my first rspec test in section 3.2, at this point the test is meant to fail but all i get are errors which I'm having a hard time interpreting. I've had a look around but not getting much luck finding a similar error and/or solution. I am brand new to programming and ruby/rails. Any help would be greatly appreciated, thank you!

terminal error output

Macintosh:sample_app rails$ bundle exec rspec spec/requests/static_pages_spec.rb 
/Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_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 /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver/common/zipper.rb:1:in `<top (required)>'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver/common.rb:9:in `require'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver/common.rb:9:in `<top (required)>'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver.rb:29:in `require'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium/webdriver.rb:29:in `<top (required)>'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium-webdriver.rb:1:in `require'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/selenium-webdriver-2.0.0/lib/selenium-webdriver.rb:1:in `<top (required)>'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
        from /Users/rails/rails_projects/sample_app/config/application.rb:12:in `<top (required)>'
        from /Users/rails/rails_projects/sample_app/config/environment.rb:2:in `require'
        from /Users/rails/rails_projects/sample_app/config/environment.rb:2:in `<top (required)>'
        from /Users/rails/rails_projects/sample_app/spec/spec_helper.rb:3:in `require'
        from /Users/rails/rails_projects/sample_app/spec/spec_helper.rb:3:in `<top (required)>'
        from /Users/rails/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `require'
        from /Users/rails/rails_projects/sample_app/spec/requests/static_pages_spec.rb:1:in `<top (required)>'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
        from /Users/rails/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

gemfile

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

gem 'rails', '4.0.0'

group :development, :test do
  gem 'sqlite3', '1.3.7'
  gem 'rspec-rails', '2.13.1'
end

group :test do
  gem 'selenium-webdriver', '2.0.0'
  gem 'capybara', '2.1.0'
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

spec_helper.rb

# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'

Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }

ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)

RSpec.configure do |config|

  config.fixture_path = "#{::Rails.root}/spec/fixtures"

  config.use_transactional_fixtures = true

  config.infer_base_class_for_anonymous_controllers = false

  config.order = "random"

  config.include Capybara::DSL
end

static_pages_specs.rb

require 'spec_helper'

describe "Static pages" do

  describe "Home page" do

    it "should have the content 'Sample App'" do
      visit '/static_pages/home'
      expect(page).to have_content('Sample App')
    end
  end
end
7
  • Just visited the site to post a similar question. I am not using Michael's tutorial. I started getting the error when i added carrierwave gem. gist.github.com/vezu/6380850 Commented Aug 30, 2013 at 6:35
  • It asking for zip library. What if you will add gem zip ? Commented Aug 30, 2013 at 6:46
  • 3
    And it seems you are using old version of gem. Try gem 'selenium-webdriver', '~> 2.35.1' latest Commented Aug 30, 2013 at 6:48
  • "require 'zip/zip'" if you are using rubyzip Commented Aug 30, 2013 at 6:49
  • @hawk you are correct.... why not add your comment as an answer, so that we can vote. Commented Aug 30, 2013 at 6:54

1 Answer 1

12

It seems you are using old version of gem. Try 'selenium-webdriver', '~> 2.35.1' latest

Sign up to request clarification or add additional context in comments.

3 Comments

Try bundle update or remove Gemfile.lock file and run bundle install again.
thank you, I have used this response. If anyone has time, could you explain why this worked? I ask because in the tutorial it often specifies specific versions of gems to use (not necessarily the latest) without any incident, yet here it caused this error.
It seems that version selenium 2.0.0 using rubyzip >= 0 which has bug in 1.0.0 github.com/rubyzip/rubyzip/issues/90 And selenium 2.35.1 using rubyzip < 1.0.0 I hope it makes sense for you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.