jackerman09
jackerman09

Reputation: 2648

Rspec error when running first tests on a new app

I am running my first test on a new app, and I am getting this error:

/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/
runtime.rb:33:in `block in setup': You have already activated rspec-core
2.14.4, but your Gemfile requires rspec-core 2.13.1. Using bundle exec
may solve this. (Gem::LoadError)

I don't know what it means by "activated rspec-core 2.14.4. I don't remember doing anything like this.

I ran the test from the command line with:

bundle exec rspec spec/requests/static_pages_spec.rb

Ruby -v: 2.0.0

Rails -v: 4.0.0

The test in question:

require 'spec_helper'

describe "Static pages" do

  describe "Home page" do

    it "should have the content 'Skeleton App'" do
      visit root_url
      expect(page).to have_content('Skeleton App')
    end
  end
end

My Gemfile:

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

gem 'rails', '4.0.0'
gem 'bootstrap-sass', '~> 3.0.1.0.rc'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.1.2'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'

gem 'devise'

group :development, :test do
  gem 'sqlite3', '1.3.7'
  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 'capybara', '2.1.0'
  gem 'factory_girl_rails', '4.2.0'
  gem 'cucumber-rails', '1.3.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

Thanks!

EDIT:

/Gemfile.lock

GIT
  remote: git://github.com/bmabey/database_cleaner.git
  revision: 6da38c4c1a565bbcc62ed9b84c2574537c6ebae2
  specs:
    database_cleaner (1.2.0)

GIT
  remote: git://github.com/sporkrb/spork-rails.git
  revision: 0dd45e59d3237b4c8f9efc215b46d9c07072a95e
  specs:
    spork-rails (4.0.0)
      rails (>= 3.0.0, < 5)
      spork (>= 1.0rc0)

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.0.0)
      actionpack (= 4.0.0)
      mail (~> 2.5.3)
    actionpack (4.0.0)
      activesupport (= 4.0.0)
      builder (~> 3.1.0)
      erubis (~> 2.7.0)
      rack (~> 1.5.2)
      rack-test (~> 0.6.2)
    activemodel (4.0.0)
      activesupport (= 4.0.0)
      builder (~> 3.1.0)
    activerecord (4.0.0)
      activemodel (= 4.0.0)
      activerecord-deprecated_finders (~> 1.0.2)
      activesupport (= 4.0.0)
      arel (~> 4.0.0)
    activerecord-deprecated_finders (1.0.3)
    activesupport (4.0.0)
      i18n (~> 0.6, >= 0.6.4)
      minitest (~> 4.2)
      multi_json (~> 1.3)
      thread_safe (~> 0.1)
      tzinfo (~> 0.3.37)
    arel (4.0.1)
    atomic (1.1.14)
    bcrypt-ruby (3.0.1)
    bootstrap-sass (3.0.1.0)
      sass (~> 3.2)
    bootstrap-will_paginate (0.0.9)
      will_paginate
    builder (3.1.4)
    capybara (2.1.0)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (~> 2.0)
    celluloid (0.15.2)
      timers (~> 1.1.0)
    childprocess (0.3.6)
      ffi (~> 1.0, >= 1.0.6)
    coderay (1.0.9)
    coffee-rails (4.0.0)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0.beta, < 5.0)
    coffee-script (2.2.0)
      coffee-script-source
      execjs
    coffee-script-source (1.6.3)
    cucumber (1.3.9)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.3)
      gherkin (~> 2.12)
      multi_json (>= 1.7.5, < 2.0)
      multi_test (>= 0.0.2)
    cucumber-rails (1.3.0)
      capybara (>= 1.1.2)
      cucumber (>= 1.1.8)
      nokogiri (>= 1.5.0)
    devise (3.2.0)
      bcrypt-ruby (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    diff-lcs (1.2.5)
    erubis (2.7.0)
    execjs (2.0.2)
    factory_girl (4.2.0)
      activesupport (>= 3.0.0)
    factory_girl_rails (4.2.0)
      factory_girl (~> 4.2.0)
      railties (>= 3.0.0)
    faker (1.1.2)
      i18n (~> 0.5)
    ffi (1.9.3)
    formatador (0.2.4)
    gherkin (2.12.2)
      multi_json (~> 1.3)
    growl (1.0.3)
    guard (2.2.3)
      formatador (>= 0.2.4)
      listen (~> 2.1)
      lumberjack (~> 1.0)
      pry (>= 0.9.12)
      thor (>= 0.18.1)
    guard-rspec (2.5.0)
      guard (>= 1.1)
      rspec (~> 2.11)
    guard-spork (1.5.0)
      childprocess (>= 0.2.3)
      guard (>= 1.1)
      spork (>= 0.8.4)
    hike (1.2.3)
    i18n (0.6.5)
    jbuilder (1.0.2)
      activesupport (>= 3.0.0)
    jquery-rails (2.2.1)
      railties (>= 3.0, < 5.0)
      thor (>= 0.14, < 2.0)
    json (1.8.1)
    json_pure (1.8.1)
    listen (2.2.0)
      celluloid (>= 0.15.2)
      rb-fsevent (>= 0.9.3)
      rb-inotify (>= 0.9)
    lumberjack (1.0.4)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    method_source (0.8.2)
    mime-types (1.25)
    mini_portile (0.5.2)
    minitest (4.7.5)
    multi_json (1.8.2)
    multi_test (0.0.2)
    nokogiri (1.6.0)
      mini_portile (~> 0.5.0)
    orm_adapter (0.4.0)
    pg (0.15.1)
    polyglot (0.3.3)
    pry (0.9.12.2)
      coderay (~> 1.0.5)
      method_source (~> 0.8)
      slop (~> 3.4)
    rack (1.5.2)
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (4.0.0)
      actionmailer (= 4.0.0)
      actionpack (= 4.0.0)
      activerecord (= 4.0.0)
      activesupport (= 4.0.0)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.0.0)
      sprockets-rails (~> 2.0.0)
    rails_12factor (0.0.2)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.1)
    rails_stdout_logging (0.0.3)
    railties (4.0.0)
      actionpack (= 4.0.0)
      activesupport (= 4.0.0)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.1.0)
    rb-fsevent (0.9.3)
    rb-inotify (0.9.2)
      ffi (>= 0.5.0)
    rdoc (3.12.2)
      json (~> 1.4)
    rspec (2.13.0)
      rspec-core (~> 2.13.0)
      rspec-expectations (~> 2.13.0)
      rspec-mocks (~> 2.13.0)
    rspec-core (2.13.1)
    rspec-expectations (2.13.0)
      diff-lcs (>= 1.1.3, < 2.0)
    rspec-mocks (2.13.1)
    rspec-rails (2.13.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 2.13.0)
      rspec-expectations (~> 2.13.0)
      rspec-mocks (~> 2.13.0)
    rubyzip (1.1.0)
    sass (3.2.12)
    sass-rails (4.0.0)
      railties (>= 4.0.0.beta, < 5.0)
      sass (>= 3.1.10)
      sprockets-rails (~> 2.0.0)
    sdoc (0.3.20)
      json (>= 1.1.3)
      rdoc (~> 3.10)
    selenium-webdriver (2.0.0)
      childprocess (>= 0.1.9)
      ffi (>= 1.0.7)
      json_pure
      rubyzip
    slop (3.4.6)
    spork (1.0.0rc4)
    sprockets (2.10.0)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    sprockets-rails (2.0.1)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (~> 2.8)
    sqlite3 (1.3.7)
    thor (0.18.1)
    thread_safe (0.1.3)
      atomic
    tilt (1.4.1)
    timers (1.1.0)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    turbolinks (1.1.1)
      coffee-rails
    tzinfo (0.3.38)
    uglifier (2.1.1)
      execjs (>= 0.3.0)
      multi_json (~> 1.0, >= 1.0.2)
    warden (1.2.3)
      rack (>= 1.0)
    will_paginate (3.0.4)
    xpath (2.0.0)
      nokogiri (~> 1.3)

PLATFORMS
  ruby

DEPENDENCIES
  bcrypt-ruby (= 3.0.1)
  bootstrap-sass (~> 3.0.1.0.rc)
  bootstrap-will_paginate (= 0.0.9)
  capybara (= 2.1.0)
  childprocess (= 0.3.6)
  coffee-rails (= 4.0.0)
  cucumber-rails (= 1.3.0)
  database_cleaner!
  devise
  factory_girl_rails (= 4.2.0)
  faker (= 1.1.2)
  growl (= 1.0.3)
  guard-rspec (= 2.5.0)
  guard-spork (= 1.5.0)
  jbuilder (= 1.0.2)
  jquery-rails (= 2.2.1)
  pg (= 0.15.1)
  rails (= 4.0.0)
  rails_12factor (= 0.0.2)
  rspec-rails (= 2.13.1)
  sass-rails (= 4.0.0)
  sdoc (= 0.3.20)
  selenium-webdriver (= 2.0.0)
  spork-rails!
  sqlite3 (= 1.3.7)
  turbolinks (= 1.1.1)
  uglifier (= 2.1.1)
  will_paginate (= 3.0.4)

Upvotes: 0

Views: 3676

Answers (3)

jackerman09
jackerman09

Reputation: 2648

I'm not sure what was causing this error, but I removed all rspec related (actually all testing related) gems from Gemfile, ran bundle install, added them back, and ran bundle install again, and so far it seems to be working.

Upvotes: 1

ksu
ksu

Reputation: 608

try this: In your Gemfile specify:

group :development, :test do 
  gem 'rspec-rails', "~> 2.14"
  #other gems for development and test only
end

then in the shell cd to your application directory and run

bundle install

Let me know if this works or if i missed something.

Upvotes: 1

brycemcd
brycemcd

Reputation: 4533

Look in your Gemfile.lock file for multiple rspec-core dependencies. It's likely one of your included gems has locked a dependency that is inconsistent with the version you're locking to.

Paste in your Gemfile.lock file here for more help.

A reasonable solution would be to use an operator in your gemfile that allows for less restrictive version locking. The pessimistic operator (`gem 'rspec-rails', '~>2.13') will allow versions of rspec-rails >= 2.13 and < 3. More info here: http://techiferous.com/2011/05/sanely-updating-your-gems/

Upvotes: 1

Related Questions