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
|
2022-07-26 00:43:48 -04:00
|
|
|
#{lockfile_platforms}
|
2018-11-02 19:07:56 -04:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-08-03 13:03:50 -04:00
|
|
|
RSpec.context "when resolving a bundle that includes yanked gems, but unlocking an unrelated gem" do
|
|
|
|
before(:each) do
|
|
|
|
build_repo4 do
|
|
|
|
build_gem "foo", "10.0.0"
|
|
|
|
|
|
|
|
build_gem "bar", "1.0.0"
|
|
|
|
build_gem "bar", "2.0.0"
|
|
|
|
end
|
|
|
|
|
|
|
|
lockfile <<-L
|
|
|
|
GEM
|
|
|
|
remote: #{file_uri_for(gem_repo4)}
|
|
|
|
specs:
|
|
|
|
foo (9.0.0)
|
|
|
|
bar (1.0.0)
|
|
|
|
|
|
|
|
PLATFORMS
|
|
|
|
#{lockfile_platforms}
|
|
|
|
|
|
|
|
DEPENDENCIES
|
|
|
|
foo
|
|
|
|
bar
|
|
|
|
|
|
|
|
BUNDLED WITH
|
|
|
|
#{Bundler::VERSION}
|
|
|
|
L
|
|
|
|
|
|
|
|
gemfile <<-G
|
|
|
|
source "#{file_uri_for(gem_repo4)}"
|
|
|
|
gem "foo"
|
|
|
|
gem "bar"
|
|
|
|
G
|
|
|
|
end
|
|
|
|
|
|
|
|
it "does not update the yanked gem" do
|
|
|
|
bundle "lock --update bar"
|
|
|
|
|
|
|
|
expect(lockfile).to eq <<~L
|
|
|
|
GEM
|
|
|
|
remote: #{file_uri_for(gem_repo4)}/
|
|
|
|
specs:
|
|
|
|
bar (2.0.0)
|
|
|
|
foo (9.0.0)
|
|
|
|
|
|
|
|
PLATFORMS
|
|
|
|
#{lockfile_platforms}
|
|
|
|
|
|
|
|
DEPENDENCIES
|
|
|
|
bar
|
|
|
|
foo
|
|
|
|
|
|
|
|
BUNDLED WITH
|
|
|
|
#{Bundler::VERSION}
|
|
|
|
L
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
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
|
2022-07-26 00:43:48 -04:00
|
|
|
#{lockfile_platforms}
|
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
|
|
|
|
2021-11-19 07:13:19 -05:00
|
|
|
expect(err).to include("Could not find rack-0.9.1 in locally installed gems")
|
2021-11-12 06:11:42 -05:00
|
|
|
expect(err).to_not include("Your bundle is locked to rack (0.9.1) from")
|
2019-04-14 02:01:35 -04:00
|
|
|
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
|
2022-07-26 00:43:48 -04:00
|
|
|
#{lockfile_platforms}
|
2021-07-23 17:49:13 -04:00
|
|
|
|
|
|
|
DEPENDENCIES
|
|
|
|
rack (= 0.9.1)
|
|
|
|
rack_middleware (1.0)
|
|
|
|
L
|
|
|
|
|
|
|
|
bundle :list, :raise_on_error => false
|
|
|
|
|
2021-11-19 07:13:19 -05:00
|
|
|
expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in locally installed gems")
|
2021-07-26 09:49:28 -04:00
|
|
|
expect(err).to include("Install missing gems with `bundle install`.")
|
2021-11-12 06:11:42 -05:00
|
|
|
expect(err).to_not include("Your bundle is locked to rack (0.9.1) from")
|
2021-07-23 17:49:13 -04:00
|
|
|
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
|