summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSchneems <richard.schneeman+foo@gmail.com>2025-12-26 12:21:51 -0600
committergit <svn-admin@ruby-lang.org>2026-01-06 04:38:13 +0000
commit4377249bbf1a27b3d860ab8948b508f1b024ba1c (patch)
tree76a3137246bc44a4be18decebd970c1811701fdf
parent16bdfa1b2a6b4cb40417e7673ad9eaa80664e4f0 (diff)
[ruby/rubygems] Test for removing current bundler version
https://github.com/ruby/rubygems/commit/675342e6d0
-rw-r--r--spec/bundler/commands/clean_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
index 6b678d0aa5..793aacf5c2 100644
--- a/spec/bundler/commands/clean_spec.rb
+++ b/spec/bundler/commands/clean_spec.rb
@@ -898,4 +898,41 @@ RSpec.describe "bundle clean" do
expect(very_simple_binary_extensions_dir).to be_nil
end
+
+ it "does not remove the bundler version currently running" do
+ gemfile <<-G
+ source "https://gem.repo1"
+
+ gem "myrack"
+ G
+
+ bundle "config set path vendor/bundle"
+ bundle "install"
+
+ version = Bundler.gem_version.to_s
+ # Simulate that the locked bundler version is installed in the bundle path
+ # by creating the gem directory and gemspec (as would happen after bundle install with that version)
+ Pathname(vendored_gems("cache/bundler-#{version}.gem")).tap do |path|
+ path.basename.mkpath
+ FileUtils.touch(path)
+ end
+ FileUtils.touch(vendored_gems("gems/bundler-#{version}"))
+ Pathname(vendored_gems("specifications/bundler-#{version}.gemspec")).tap do |path|
+ path.basename.mkpath
+ path.write(<<~GEMSPEC)
+ Gem::Specification.new do |s|
+ s.name = "bundler"
+ s.version = "#{version}"
+ s.authors = ["bundler team"]
+ s.summary = "The best way to manage your application's dependencies"
+ end
+ GEMSPEC
+ end
+
+ should_have_gems "bundler-#{version}"
+
+ bundle :clean
+
+ should_have_gems "bundler-#{version}"
+ end
end