Trying to use rspec, but getting an error that rspec-core 2.2.1 has been activated, but my Gemfile requires rspec-core 2.1.0

后端 未结 6 843
没有蜡笔的小新
没有蜡笔的小新 2021-02-08 03:35

I\'ve update my gems. I\'ve created a sample Rails app and have the following in my Gemfile:

source \'http://rubygems.org\'

gem \'rails\', \'3.0.3\'
gem \'sqli         


        
相关标签:
6条回答
  • 2021-02-08 03:57

    Rails noob here ... I'm following Michael Hartl's brilliant tutorial ... stuck at layouts

    Tried changing rspec & webrat versions as mentioned in this post about rspec/webrat errors to no avail.

    For rspec v2.1.0 I get the same error as @user338413.

    rspec -v returns 2.2.1


    dev machine running ubuntu 10.04

    resolved....works with rspec 2.2.0 + webrat 0.7.1, although I would still like to know why

    0 讨论(0)
  • 2021-02-08 04:09

    try using bundle update rspec and bundle update rspec-rails. your Gemfile.lock file, located in the root directory, is probably specifying a version number for each gem.

    0 讨论(0)
  • 2021-02-08 04:11

    A combination of Sam Ritchie's and Alexey's solutions helped me here. In the end I had to:

    bundle update rspec
    bundle update rspec-rails
    sudo gem uninstall rspec-mocks
    sudo gem uninstall rspec-expectations
    sudo gem uninstall rspec-core
    

    (prompts for versions if none are entered)

    As Alexey says, use this to see which versions are too high:

    gem list rspec
    

    (Would vote for you Alexey, but apparently I don't have enough of a "reputation" on stack.)

    0 讨论(0)
  • 2021-02-08 04:14

    change the version number from 2.1.0 to 2.2.1 in Gemfile.lock

    0 讨论(0)
  • 2021-02-08 04:16

    I got the same issue right now. to fix it try to:

    sudo gem uninstall rspec-core -v 2.2.1
    bundle update rspec-core
    

    You may need to do that for other dependent gems (like rspec, rspec-rails etc). Use the command to see the candidates:

    gem list rspec
    
    0 讨论(0)
  • 2021-02-08 04:17

    This is easily solved:

    bundle exec rspec
    

    will force bundler to use the gem version you are requiring for your project, ignoring system-wide settings.

    0 讨论(0)
提交回复
热议问题