2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-28 08:35:36 +00:00
|
|
|
require "cmd/shared_examples/args_parse"
|
|
|
|
|
2021-02-01 16:14:25 -05:00
|
|
|
describe "brew cleanup" do
|
2020-09-03 09:43:41 +01:00
|
|
|
before do
|
|
|
|
FileUtils.mkdir_p HOMEBREW_LIBRARY/"Homebrew/vendor/"
|
|
|
|
FileUtils.touch HOMEBREW_LIBRARY/"Homebrew/vendor/portable-ruby-version"
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
FileUtils.rm_rf HOMEBREW_LIBRARY/"Homebrew"
|
|
|
|
end
|
|
|
|
|
2021-02-01 16:14:25 -05:00
|
|
|
it_behaves_like "parseable arguments"
|
|
|
|
|
|
|
|
describe "--prune=all", :integration_test do
|
2017-02-23 06:00:11 +01:00
|
|
|
it "removes all files in Homebrew's cache" do
|
|
|
|
(HOMEBREW_CACHE/"test").write "test"
|
|
|
|
|
|
|
|
expect { brew "cleanup", "--prune=all" }
|
2020-11-16 22:18:56 +01:00
|
|
|
.to output(%r{#{Regexp.escape(HOMEBREW_CACHE)}/test}o).to_stdout
|
2017-02-23 06:00:11 +01:00
|
|
|
.and not_to_output.to_stderr
|
|
|
|
.and be_a_success
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|