Skip to content

Commit 675342e

Browse files
committed
Test for removing current bundler version
1 parent 5a6eca4 commit 675342e

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

bundler/spec/commands/clean_spec.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,4 +898,41 @@ def should_not_have_gems(*gems)
898898

899899
expect(very_simple_binary_extensions_dir).to be_nil
900900
end
901+
902+
it "does not remove the bundler version currently running" do
903+
gemfile <<-G
904+
source "https://gem.repo1"
905+
906+
gem "myrack"
907+
G
908+
909+
bundle "config set path vendor/bundle"
910+
bundle "install"
911+
912+
version = Bundler.gem_version.to_s
913+
# Simulate that the locked bundler version is installed in the bundle path
914+
# by creating the gem directory and gemspec (as would happen after bundle install with that version)
915+
Pathname(vendored_gems("cache/bundler-#{version}.gem")).tap do |path|
916+
path.basename.mkpath
917+
FileUtils.touch(path)
918+
end
919+
FileUtils.touch(vendored_gems("gems/bundler-#{version}"))
920+
Pathname(vendored_gems("specifications/bundler-#{version}.gemspec")).tap do |path|
921+
path.basename.mkpath
922+
path.write(<<~GEMSPEC)
923+
Gem::Specification.new do |s|
924+
s.name = "bundler"
925+
s.version = "#{version}"
926+
s.authors = ["bundler team"]
927+
s.summary = "The best way to manage your application's dependencies"
928+
end
929+
GEMSPEC
930+
end
931+
932+
should_have_gems "bundler-#{version}"
933+
934+
bundle :clean
935+
936+
should_have_gems "bundler-#{version}"
937+
end
901938
end

0 commit comments

Comments
 (0)