2015-12-04 30 views
0

我试图将我的项目从rspec-rails 2.14升级到最新版本。我正在关注these instructions。我遇到了安装RSpec 2.99的问题。加入gem 'rspec-rails', '~> 2.99.0'Gemfile和运行bundle install后,我看到以下错误:升级到RSpec 3的问题

Bundler could not find compatible versions for gem "rspec-core": 
    In snapshot (Gemfile.lock): 
    rspec-core (= 2.14.8) 

    In Gemfile: 
    guard-rspec (>= 0) ruby depends on 
     rspec (< 4.0, >= 2.14) ruby depends on 
     rspec-core (~> 2.14.0) ruby 

    rspec-rails (~> 2.99.0) ruby depends on 
     rspec-core (~> 2.99.0) ruby 

Running `bundle update` will rebuild your snapshot from scratch, using only 
the gems in your Gemfile, which may resolve the conflict. 

我怎样才能解决这个问题而影响到尽可能少的宝石版本越好?我只想更新RSpec,没有别的。如果我在没有任何参数的情况下运行bundle update,它会更新一堆其他宝石,并使我的一堆测试失败。我可以单独更新像rspec-core这样的依赖宝石到某个特定版本吗?

回答

0

找出问题所在。我的Gemfile中只有gem rspec-rails,并且必须添加gem 'rspec', '~> 2.99.0'。运行bundle update rspec rspec-rails然后工作正常,我的Gemfile.lock显示正确的版本。