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
|
|
|
|
|
|
|
|
install_gemfile <<-G
|
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"
|
|
|
|
|
2018-11-02 19:07:56 -04:00
|
|
|
install_gemfile <<-G
|
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
|
|
|
|
|
|
|
|
bundle :list
|
|
|
|
|
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
|
|
|
|
end
|