Reputation: 19090
I’m using Rails 4.2.10. I have the following version of spec …
$ bin/rspec --version
/Library/Ruby/Gems/2.6.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated
3.4.4
In my Gemfile, I have
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
…
rspec-rails (3.4.2)
actionpack (>= 3.0, < 4.3)
activesupport (>= 3.0, < 4.3)
railties (>= 3.0, < 4.3)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
How do I upgrade spec to a specific version (I want 3.10.0). I tried changing my Gemfile.lock version to look like
rspec (3.10.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
And then re-ran “bundle install”, but I still show “3.4.4” when I check the version of bin/rspec.
Edit: In response to answer given in comment ...
Tried changing my Gemfile “spec-rails” dependency to
gem 'rspec-rails', '~> 3.9.1'
And then running the below but I guess there are a series of dependencies that result in things like the below
$ bundle install
…
deprecated
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies........
Bundler could not find compatible versions for gem "rspec-support":
In snapshot (Gemfile.lock):
rspec-support (= 3.4.1)
In Gemfile:
guard-rspec was resolved to 4.6.4, which depends on
rspec (>= 2.99.0, < 4.0) was resolved to 3.10.0, which depends on
rspec-mocks (~> 3.4.0) was resolved to 3.4.1, which depends on
rspec-support (~> 3.4.0)
rspec-rails (~> 3.9.1) was resolved to 3.9.1, which depends on
rspec-support (~> 3.9.0)
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Not quite sure how to proceed with the upgrade.
Upvotes: 1
Views: 1164
Reputation: 3632
Upgrade all gems that are mentioned and might collide with their required RSpec-version. The output tells you, that guard-rspec collides with a newer RSpec-version. Try with:
bundle update rspec rspec-rails guard-rspec
If then there is another error with new Gems, try adding those to the command, too. Transitive dependencies, that are not listed in your Gemfile are generally not required to list (rspec-mocks etc.).
Summary: Try upgrading all related offending Gems at once.
Also, as Les said, you are not supposed to update Gemfile.lock manually (except in case of Merge Conflicts), but only through bundle update [GEMNAME]
.
Deleting Gemfile.lock is a last resort, as you will lose your current, maybe well-functioning, dependency situation and upgrade all Gems at once to their newest version, as specified in the Gemfile.
Upvotes: 1