aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-16 22:00:29 +0100
committerMarkus Reiter2017-02-16 22:00:42 +0100
commitb51161b08b3e3b26d279952a34e9e54da4a059f0 (patch)
treef98f6cce11dcf8623d8134cfe379d80b6bda836f /Library
parentfcd88b71f5eb0d9915264473dd0c155003563f89 (diff)
downloadbrew-b51161b08b3e3b26d279952a34e9e54da4a059f0.tar.bz2
Add test for non-existant `uninstall script:`.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/spec/cask/cli/uninstall_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/spec/cask/cli/uninstall_spec.rb b/Library/Homebrew/cask/spec/cask/cli/uninstall_spec.rb
index 243be49d9..a1b47e823 100644
--- a/Library/Homebrew/cask/spec/cask/cli/uninstall_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/cli/uninstall_spec.rb
@@ -60,6 +60,34 @@ describe Hbc::CLI::Uninstall do
expect(Hbc.appdir.join("MyFancyApp.app")).not_to exist
end
+ it "can uninstall Casks when the uninstall script is missing, but only when using `--force`" do
+ cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-script-app.rb")
+
+ shutup do
+ Hbc::Installer.new(cask).install
+ end
+
+ expect(cask).to be_installed
+
+ Hbc.appdir.join("MyFancyApp.app").rmtree
+
+ expect {
+ shutup do
+ Hbc::CLI::Uninstall.run("with-uninstall-script-app")
+ end
+ }.to raise_error(Hbc::CaskError, /does not exist/)
+
+ expect(cask).to be_installed
+
+ expect {
+ shutup do
+ Hbc::CLI::Uninstall.run("with-uninstall-script-app", "--force")
+ end
+ }.not_to raise_error
+
+ expect(cask).not_to be_installed
+ end
+
describe "when multiple versions of a cask are installed" do
let(:token) { "versioned-cask" }
let(:first_installed_version) { "1.2.3" }