2018-11-02 19:07:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.context "when installing a bundle that includes yanked gems" do
|
|
|
|
before(:each) do
|
|
|
|
build_repo4 do
|
|
|
|
build_gem "foo", "9.0.0"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it "throws an error when the original gem version is yanked" do
|
|
|
|
lockfile <<-L
|
|
|
|
GEM
|
2019-05-06 12:06:21 -04:00
|
|
|
remote: #{file_uri_for(gem_repo4)}
|
2018-11-02 19:07:56 -04:00
|
|
|
specs:
|
|
|
|
foo (10.0.0)
|
|
|
|
|
|
|
|
PLATFORMS
|
|
|
|
ruby
|
|
|
|
|
|
|
|
DEPENDENCIES
|
|
|
|
foo (= 10.0.0)
|
|
|
|
|
|
|
|
L
|
|
|
|
|
2020-06-03 12:43:17 -04:00
|
|
|
install_gemfile <<-G, :raise_on_error => false
|
2019-07-23 07:01:13 -04:00
|
|
|
source "#{file_uri_for(gem_repo4)}"
|
|
|
|
gem "foo", "10.0.0"
|
2018-11-02 19:07:56 -04:00
|
|
|
G
|
|
|
|
|
2019-04-14 02:01:35 -04:00
|
|
|
expect(err).to include("Your bundle is locked to foo (10.0.0)")
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "throws the original error when only the Gemfile specifies a gem version that doesn't exist" do
|
2019-07-23 07:11:33 -04:00
|
|
|
bundle "config set force_ruby_platform true"
|
|
|
|
|
2020-06-03 12:43:17 -04:00
|
|
|
install_gemfile <<-G, :raise_on_error => false
|
2019-07-23 07:01:13 -04:00
|
|
|
source "#{file_uri_for(gem_repo4)}"
|
|
|
|
gem "foo", "10.0.0"
|
2018-11-02 19:07:56 -04:00
|
|
|
G
|
|
|
|
|
2019-04-14 02:01:35 -04:00
|
|
|
expect(err).not_to include("Your bundle is locked to foo (10.0.0)")
|
|
|
|
expect(err).to include("Could not find gem 'foo (= 10.0.0)' in")
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.context "when using gem before installing" do
|
|
|
|
it "does not suggest the author has yanked the gem" do
|
|
|
|
gemfile <<-G
|
2019-07-23 07:01:13 -04:00
|
|
|
source "#{file_uri_for(gem_repo1)}"
|
|
|
|
gem "rack", "0.9.1"
|
2018-11-02 19:07:56 -04:00
|
|
|
G
|
|
|
|
|
|
|
|
lockfile <<-L
|
2019-07-23 07:01:13 -04:00
|
|
|
GEM
|
|
|
|
remote: #{file_uri_for(gem_repo1)}
|
|
|
|
specs:
|
|
|
|
rack (0.9.1)
|
2018-11-02 19:07:56 -04:00
|
|
|
|
2019-07-23 07:01:13 -04:00
|
|
|
PLATFORMS
|
|
|
|
ruby
|
2018-11-02 19:07:56 -04:00
|
|
|
|
2019-07-23 07:01:13 -04:00
|
|
|
DEPENDENCIES
|
|
|
|
rack (= 0.9.1)
|
2018-11-02 19:07:56 -04:00
|
|
|
L
|
|
|
|
|
2020-06-03 12:43:17 -04:00
|
|
|
bundle :list, :raise_on_error => false
|
2018-11-02 19:07:56 -04:00
|
|
|
|
2019-04-14 02:01:35 -04:00
|
|
|
expect(err).to include("Could not find rack-0.9.1 in any of the sources")
|
|
|
|
expect(err).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.")
|
|
|
|
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
|
|
|
|
expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
2021-07-23 17:49:13 -04:00
|
|
|
|
|
|
|
it "does not suggest the author has yanked the gem when using more than one gem, but shows all gems that couldn't be found in the source" do
|
|
|
|
gemfile <<-G
|
|
|
|
source "#{file_uri_for(gem_repo1)}"
|
|
|
|
gem "rack", "0.9.1"
|
|
|
|
gem "rack_middleware", "1.0"
|
|
|
|
G
|
|
|
|
|
|
|
|
lockfile <<-L
|
|
|
|
GEM
|
|
|
|
remote: #{file_uri_for(gem_repo1)}
|
|
|
|
specs:
|
|
|
|
rack (0.9.1)
|
|
|
|
rack_middleware (1.0)
|
|
|
|
|
|
|
|
PLATFORMS
|
|
|
|
ruby
|
|
|
|
|
|
|
|
DEPENDENCIES
|
|
|
|
rack (= 0.9.1)
|
|
|
|
rack_middleware (1.0)
|
|
|
|
L
|
|
|
|
|
|
|
|
bundle :list, :raise_on_error => false
|
|
|
|
|
|
|
|
expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in any of the sources")
|
2021-07-26 09:49:28 -04:00
|
|
|
expect(err).to include("Install missing gems with `bundle install`.")
|
2021-07-23 17:49:13 -04:00
|
|
|
expect(err).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.")
|
|
|
|
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
|
|
|
|
expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
|
|
|
|
end
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|