diff options
| author | Markus Reiter | 2017-02-23 06:03:16 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-02-23 21:24:39 +0100 |
| commit | b927bfc4c0727aa06b6c9a757aa26231da580798 (patch) | |
| tree | 40d44b79084a4b143cf2ac752609c9098e8181d3 /Library/Homebrew/test/cmd | |
| parent | c7121f6be50e44784e3e29114617c29715bd9c0f (diff) | |
| download | brew-b927bfc4c0727aa06b6c9a757aa26231da580798.tar.bz2 | |
Convert `brew prune` test to spec.
Diffstat (limited to 'Library/Homebrew/test/cmd')
| -rw-r--r-- | Library/Homebrew/test/cmd/prune_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cmd/prune_spec.rb b/Library/Homebrew/test/cmd/prune_spec.rb new file mode 100644 index 000000000..c5a9df70c --- /dev/null +++ b/Library/Homebrew/test/cmd/prune_spec.rb @@ -0,0 +1,28 @@ +describe "brew prune", :integration_test do + it "removes empty directories and broken symlinks" do + share = (HOMEBREW_PREFIX/"share") + + (share/"pruneable/directory/here").mkpath + (share/"notpruneable/file").write "I'm here" + FileUtils.ln_s "/i/dont/exist/no/really/i/dont", share/"pruneable_symlink" + + expect { brew "prune", "--dry-run" } + .to output(%r{Would remove \(empty directory\): .*/pruneable/directory/here}).to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect { brew "prune" } + .to output(/Pruned 1 symbolic links and 3 directories/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + + expect(share/"pruneable").not_to be_a_directory + expect(share/"notpruneable").to be_a_directory + expect(share/"pruneable_symlink").not_to be_a_symlink + + expect { brew "prune", "--verbose" } + .to output(/Nothing pruned/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end +end |
