summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <2887858+deivid-rodriguez@users.noreply.github.com>2025-09-09 19:22:06 +0200
committergit <svn-admin@ruby-lang.org>2025-10-15 07:15:48 +0000
commit92cbd7ec3354e652d8fcc52ad772bc4699475469 (patch)
tree9204e5e8fb8d3ff76f3c157cb84637db84734f48
parentd99a4295a8e2727023292ac78c058bdfc922c2a6 (diff)
[rubygems/rubygems] Test current clean after bundle update behavior
https://github.com/rubygems/rubygems/commit/c43e35c3ea
-rw-r--r--spec/bundler/commands/clean_spec.rb43
1 files changed, 39 insertions, 4 deletions
diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb
index f2cd886893..6b678d0aa5 100644
--- a/spec/bundler/commands/clean_spec.rb
+++ b/spec/bundler/commands/clean_spec.rb
@@ -220,7 +220,7 @@ RSpec.describe "bundle clean" do
expect(bundled_app("symlink-path/#{Bundler.ruby_scope}/bundler/gems/foo-#{revision[0..11]}")).to exist
end
- it "removes old git gems" do
+ it "removes old git gems on bundle update" do
build_git "foo-bar", path: lib_path("foo-bar")
revision = revision_for(lib_path("foo-bar"))
@@ -383,7 +383,7 @@ RSpec.describe "bundle clean" do
expect(out).to include("myrack (1.0.0)").and include("thin (1.0)")
end
- it "automatically cleans when path has not been set", bundler: "5" do
+ it "does not clean on bundle update when path has not been set" do
build_repo2
install_gemfile <<-G
@@ -398,8 +398,43 @@ RSpec.describe "bundle clean" do
bundle "update", all: true
- files = Pathname.glob(bundled_app(".bundle", Bundler.ruby_scope, "*", "*"))
- files.map! {|f| f.to_s.sub(bundled_app(".bundle", Bundler.ruby_scope).to_s, "") }
+ files = Pathname.glob(default_bundle_path("*", "*"))
+ files.map! {|f| f.to_s.sub(default_bundle_path.to_s, "") }
+ expected_files = %W[
+ /bin/bundle
+ /bin/bundler
+ /cache/bundler-#{Bundler::VERSION}.gem
+ /cache/foo-1.0.1.gem
+ /cache/foo-1.0.gem
+ /gems/bundler-#{Bundler::VERSION}
+ /gems/foo-1.0
+ /gems/foo-1.0.1
+ /specifications/bundler-#{Bundler::VERSION}.gemspec
+ /specifications/foo-1.0.1.gemspec
+ /specifications/foo-1.0.gemspec
+ ]
+ expected_files += ["/bin/bundle.bat", "/bin/bundler.bat"] if Gem.win_platform?
+
+ expect(files.sort).to eq(expected_files.sort)
+ end
+
+ it "will automatically clean on bundle update when path has not been set", bundler: "5" do
+ build_repo2
+
+ install_gemfile <<-G
+ source "https://gem.repo2"
+
+ gem "foo"
+ G
+
+ update_repo2 do
+ build_gem "foo", "1.0.1"
+ end
+
+ bundle "update", all: true
+
+ files = Pathname.glob(local_gem_path("*", "*"))
+ files.map! {|f| f.to_s.sub(local_gem_path.to_s, "") }
expect(files.sort).to eq %w[
/cache/foo-1.0.1.gem
/gems/foo-1.0.1