diff options
| author | Joshua McKinney | 2017-03-21 04:13:13 -0500 |
|---|---|---|
| committer | Joshua McKinney | 2017-03-31 01:44:04 -0500 |
| commit | 48fdd163bcf9ab52f4ac708def700b7b6ab218a4 (patch) | |
| tree | 35ac9983769886aa66c86758b76413fde3b0a3da /Library/Homebrew/test | |
| parent | 00af5250f0a7988178ed8d26520bf1a98a8dea9a (diff) | |
| download | brew-48fdd163bcf9ab52f4ac708def700b7b6ab218a4.tar.bz2 | |
Brew cleanup: Continue on error removing keg
Fixes #2355
Create unremovable_kegs instance var
Check cellar cleanup failure after full cleanup completes
Use module_function in Homebrew::Cleanup as we never instantiate the
class
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/cleanup_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cleanup_spec.rb b/Library/Homebrew/test/cleanup_spec.rb index b0e824767..2c3eddb8c 100644 --- a/Library/Homebrew/test/cleanup_spec.rb +++ b/Library/Homebrew/test/cleanup_spec.rb @@ -34,6 +34,39 @@ describe Homebrew::Cleanup do expect(ds_store).to exist end + + context "when it can't remove a keg" do + let(:f1) { Class.new(Testball) { version "0.1" }.new } + let(:f2) { Class.new(Testball) { version "0.2" }.new } + let(:unremovable_kegs) { [] } + + before(:each) do + described_class.instance_variable_set(:@unremovable_kegs, []) + shutup do + [f1, f2].each do |f| + f.brew do + f.install + end + + Tab.create(f, DevelopmentTools.default_compiler, :libcxx).write + end + end + + allow_any_instance_of(Keg) + .to receive(:uninstall) + .and_raise(Errno::EACCES) + end + + it "doesn't remove any kegs" do + shutup { described_class.cleanup_formula f2 } + expect(f1.installed_kegs.size).to eq(2) + end + + it "lists the unremovable kegs" do + shutup { described_class.cleanup_formula f2 } + expect(described_class.unremovable_kegs).to contain_exactly(f1.installed_kegs[0]) + end + end end specify "::cleanup_formula" do |
