diff options
| author | Mike McQuaid | 2017-03-31 09:43:47 +0100 |
|---|---|---|
| committer | GitHub | 2017-03-31 09:43:47 +0100 |
| commit | 80b39bb23917d9b80bb80eb15a890607d69e65b6 (patch) | |
| tree | f43ee6966970a9c32dcf3ef9e61bf0ee362f0dd6 /Library/Homebrew/test | |
| parent | 1ba401039eeafec6dca464e9be18a5257a3d89bc (diff) | |
| parent | 48fdd163bcf9ab52f4ac708def700b7b6ab218a4 (diff) | |
| download | brew-80b39bb23917d9b80bb80eb15a890607d69e65b6.tar.bz2 | |
Merge pull request #2374 from joshka/cleanup-command-continue-on-error
Cleanup: Continue on error removing keg
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 |
