升级到RSpec 3的问题

时间:2015-12-04 16:57:29

标签: ruby-on-rails rspec rspec-rails

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

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等依赖宝石?

1 个答案:

答案 0 :(得分:0)

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

相关问题