brew/Library/Homebrew/test/cmd/cleanup_spec.rb
Maxim Belkin a6d29894d9 cleanup: fix and reuse portable ruby logic.
Align the logic in `cleanup_portable_ruby` with that in `ruby.sh`.

Co-authored-by: Maxim Belkin <maxim.belkin@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-09-03 09:43:41 +01:00

30 lines
742 B
Ruby

# frozen_string_literal: true
require "cmd/shared_examples/args_parse"
describe "Homebrew.cleanup_args" do
it_behaves_like "parseable arguments"
end
describe "brew cleanup", :integration_test do
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
describe "--prune=all" do
it "removes all files in Homebrew's cache" do
(HOMEBREW_CACHE/"test").write "test"
expect { brew "cleanup", "--prune=all" }
.to output(%r{#{Regexp.escape(HOMEBREW_CACHE)}/test}).to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
end
end