diff options
-rw-r--r-- | lib/bundler/cli/clean.rb | 2 | ||||
-rw-r--r-- | spec/commands/clean_spec.rb | 32 |
2 files changed, 32 insertions, 2 deletions
diff --git a/lib/bundler/cli/clean.rb b/lib/bundler/cli/clean.rb index 895b6567fa..5eba09c6bc 100644 --- a/lib/bundler/cli/clean.rb +++ b/lib/bundler/cli/clean.rb @@ -8,7 +8,7 @@ module Bundler end def run - require_path_or_force + require_path_or_force unless options[:"dry-run"] Bundler.load.clean(options[:"dry-run"]) end diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index 72d422c3a2..acec0eef95 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -567,7 +567,7 @@ describe "bundle clean" do expect(exitstatus).to eq(0) if exitstatus end - it "doesn't remove gems in dry-run mode" do + it "doesn't remove gems in dry-run mode with path set" do gemfile <<-G source "file://#{gem_repo1}" @@ -595,6 +595,36 @@ describe "bundle clean" do expect(vendored_gems("bin/rackup")).to exist end + it "doesn't remove gems in dry-run mode with no path set" do + gemfile <<-G + source "file://#{gem_repo1}" + + gem "thin" + gem "foo" + G + + bundle "install --path vendor/bundle --no-clean" + + gemfile <<-G + source "file://#{gem_repo1}" + + gem "thin" + G + + bundle :install + + bundle "configuration --delete path" + + bundle "clean --dry-run" + + expect(out).not_to include("Removing foo (1.0)") + expect(out).to include("Would have removed foo (1.0)") + + should_have_gems "thin-1.0", "rack-1.0.0", "foo-1.0" + + expect(vendored_gems("bin/rackup")).to exist + end + it "doesn't store dry run as a config setting" do gemfile <<-G source "file://#{gem_repo1}" |