diff options
| author | mansimarkaur | 2017-08-04 05:47:05 +0530 |
|---|---|---|
| committer | mansimarkaur | 2017-08-27 01:18:40 +0530 |
| commit | 265d43444bcd09d5d54963161f2fe77cdef35ef9 (patch) | |
| tree | 139cdb1dff609eb18e2eaf8c651a6a370848ede7 /Library/Homebrew/test/cleanup_spec.rb | |
| parent | 5e17d63010c74dd23f02222feb61b76f515908d4 (diff) | |
| download | brew-265d43444bcd09d5d54963161f2fe77cdef35ef9.tar.bz2 | |
improved prune all test
Diffstat (limited to 'Library/Homebrew/test/cleanup_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/cleanup_spec.rb | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/Library/Homebrew/test/cleanup_spec.rb b/Library/Homebrew/test/cleanup_spec.rb index f1a6e770e..da6796d5f 100644 --- a/Library/Homebrew/test/cleanup_spec.rb +++ b/Library/Homebrew/test/cleanup_spec.rb @@ -164,20 +164,37 @@ describe Homebrew::Cleanup do expect(npm_cache).not_to exist end - it "cleans up files and directories with name containing -- if ARGV prune is all" do - a = (HOMEBREW_CACHE/"--a") - b = (HOMEBREW_CACHE/"b") - c = (HOMEBREW_CACHE/"c") - a.mkpath - b.mkpath - FileUtils.touch c + it "cleans up all files and directories" do + git = (HOMEBREW_CACHE/"gist--git") + gist = (HOMEBREW_CACHE/"gist") + svn = (HOMEBREW_CACHE/"gist--svn") + git.mkpath + gist.mkpath + FileUtils.touch svn allow(ARGV).to receive(:value).with("prune").and_return("all") - shutup do - described_class.cleanup_cache + begin + shutup do + described_class.cleanup_cache + end + expect(git).not_to exist + expect(gist).to exist + expect(svn).not_to exist + ensure + FileUtils.rm_rf(git) + FileUtils.rm_rf(gist) + FileUtils.rm_rf(svn) + end + end + + it "raises error when formula name is ambiguous" do + bottle = (HOMEBREW_CACHE/"foo-0.2.bottle.gz") + FileUtils.touch bottle + (HOMEBREW_CELLAR/"foo/foo-0.2").mkpath + begin + described_class.cleanup_cache + ensure + FileUtils.rm_rf(bottle) end - expect(a).not_to exist - expect(b).to exist - expect(c).not_to exist end end end |
