From 3703ef1885ba4afce1ed4ae531dcb7ddc573b3c2 Mon Sep 17 00:00:00 2001 From: Joshua McKinney Date: Sat, 18 Mar 2017 18:57:04 -0500 Subject: Show messages when (un)installing Casks Addresses an issue where it can be unclear at times exactly which part of the (un|re)installation processes is reporting an error. See https://github.com/caskroom/homebrew-cask/issues/30968 --- Library/Homebrew/test/cask/cli/install_spec.rb | 14 ++++++++++++++ Library/Homebrew/test/cask/cli/reinstall_spec.rb | 23 +++++++++++++++++++++++ Library/Homebrew/test/cask/cli/uninstall_spec.rb | 17 +++++++++++++++++ 3 files changed, 54 insertions(+) (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/cask/cli/install_spec.rb b/Library/Homebrew/test/cask/cli/install_spec.rb index 5a40017e8..fef0b2824 100644 --- a/Library/Homebrew/test/cask/cli/install_spec.rb +++ b/Library/Homebrew/test/cask/cli/install_spec.rb @@ -1,4 +1,18 @@ describe Hbc::CLI::Install, :cask do + it "displays the installation progress" do + output = Regexp.new <<-EOS.undent + ==> Downloading file:.*/caffeine.zip + ==> Verifying checksum for Cask local-caffeine + ==> Installing Cask local-caffeine + ==> Moving App 'Caffeine.app' to '.*/Caffeine.app'. + 🍺 local-caffeine was successfully installed! + EOS + + expect { + Hbc::CLI::Install.run("local-caffeine") + }.to output(output).to_stdout + end + it "allows staging and activation of multiple Casks at once" do shutup do Hbc::CLI::Install.run("local-transmission", "local-caffeine") diff --git a/Library/Homebrew/test/cask/cli/reinstall_spec.rb b/Library/Homebrew/test/cask/cli/reinstall_spec.rb index e573a3470..7f3c60bc4 100644 --- a/Library/Homebrew/test/cask/cli/reinstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/reinstall_spec.rb @@ -1,4 +1,27 @@ describe Hbc::CLI::Reinstall, :cask do + it "displays the reinstallation progress" do + caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") + + shutup do + Hbc::Installer.new(caffeine).install + end + + output = Regexp.new <<-EOS.undent + ==> Downloading file:.*/caffeine.zip + Already downloaded: .*/local-caffeine--1.2.3.zip + ==> Verifying checksum for Cask local-caffeine + ==> Uninstalling Cask local-caffeine + ==> Removing App '.*/Caffeine.app'. + ==> Installing Cask local-caffeine + ==> Moving App 'Caffeine.app' to '.*/Caffeine.app'. + 🍺 local-caffeine was successfully installed! + EOS + + expect { + Hbc::CLI::Reinstall.run("local-caffeine") + }.to output(output).to_stdout + end + it "allows reinstalling a Cask" do shutup do Hbc::CLI::Install.run("local-transmission") diff --git a/Library/Homebrew/test/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb index fb196ee72..714e652c7 100644 --- a/Library/Homebrew/test/cask/cli/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/uninstall_spec.rb @@ -1,4 +1,21 @@ describe Hbc::CLI::Uninstall, :cask do + it "displays the uninstallation progress" do + caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") + + shutup do + Hbc::Installer.new(caffeine).install + end + + output = Regexp.new <<-EOS.undent + ==> Uninstalling Cask local-caffeine + ==> Removing App '.*/Caffeine.app'. + EOS + + expect { + Hbc::CLI::Uninstall.run("local-caffeine") + }.to output(output).to_stdout + end + it "shows an error when a bad Cask is provided" do expect { Hbc::CLI::Uninstall.run("notacask") -- cgit v1.2.3 From d11e417105c04a1c21edfb4481bc26e21f1c94f9 Mon Sep 17 00:00:00 2001 From: Joshua McKinney Date: Sat, 18 Mar 2017 18:59:28 -0500 Subject: Hide output from brew cask uninstall test This test showed extraneous info in the test output --- Library/Homebrew/test/cask/cli/uninstall_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb index 714e652c7..036c47b5c 100644 --- a/Library/Homebrew/test/cask/cli/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/uninstall_spec.rb @@ -30,7 +30,9 @@ describe Hbc::CLI::Uninstall, :cask do it "tries anyway on a non-present Cask when --force is given" do expect { - Hbc::CLI::Uninstall.run("local-caffeine", "--force") + shutup do + Hbc::CLI::Uninstall.run("local-caffeine", "--force") + end }.not_to raise_error end -- cgit v1.2.3 From 437db065caad8cb607373c41c3dc7bb2e3c58a66 Mon Sep 17 00:00:00 2001 From: Joshua McKinney Date: Sun, 19 Mar 2017 19:56:41 -0500 Subject: Be a little less specific in cask output tests These tests seemed a little over-specified and were failing on the CI server. Reducing the specificity a little to try to get them to pass. --- Library/Homebrew/test/cask/cli/install_spec.rb | 6 +++--- Library/Homebrew/test/cask/cli/reinstall_spec.rb | 10 +++++----- Library/Homebrew/test/cask/cli/uninstall_spec.rb | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/cask/cli/install_spec.rb b/Library/Homebrew/test/cask/cli/install_spec.rb index fef0b2824..219b9522e 100644 --- a/Library/Homebrew/test/cask/cli/install_spec.rb +++ b/Library/Homebrew/test/cask/cli/install_spec.rb @@ -1,11 +1,11 @@ describe Hbc::CLI::Install, :cask do it "displays the installation progress" do output = Regexp.new <<-EOS.undent - ==> Downloading file:.*/caffeine.zip + ==> Downloading file:.*caffeine.zip ==> Verifying checksum for Cask local-caffeine ==> Installing Cask local-caffeine - ==> Moving App 'Caffeine.app' to '.*/Caffeine.app'. - 🍺 local-caffeine was successfully installed! + ==> Moving App 'Caffeine.app' to '.*Caffeine.app'. + .*local-caffeine was successfully installed! EOS expect { diff --git a/Library/Homebrew/test/cask/cli/reinstall_spec.rb b/Library/Homebrew/test/cask/cli/reinstall_spec.rb index 7f3c60bc4..8885fa199 100644 --- a/Library/Homebrew/test/cask/cli/reinstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/reinstall_spec.rb @@ -7,14 +7,14 @@ describe Hbc::CLI::Reinstall, :cask do end output = Regexp.new <<-EOS.undent - ==> Downloading file:.*/caffeine.zip - Already downloaded: .*/local-caffeine--1.2.3.zip + ==> Downloading file:.*caffeine.zip + Already downloaded: .*local-caffeine--1.2.3.zip ==> Verifying checksum for Cask local-caffeine ==> Uninstalling Cask local-caffeine - ==> Removing App '.*/Caffeine.app'. + ==> Removing App '.*Caffeine.app'. ==> Installing Cask local-caffeine - ==> Moving App 'Caffeine.app' to '.*/Caffeine.app'. - 🍺 local-caffeine was successfully installed! + ==> Moving App 'Caffeine.app' to '.*Caffeine.app'. + .*local-caffeine was successfully installed! EOS expect { diff --git a/Library/Homebrew/test/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb index 036c47b5c..4089c47b4 100644 --- a/Library/Homebrew/test/cask/cli/uninstall_spec.rb +++ b/Library/Homebrew/test/cask/cli/uninstall_spec.rb @@ -8,7 +8,7 @@ describe Hbc::CLI::Uninstall, :cask do output = Regexp.new <<-EOS.undent ==> Uninstalling Cask local-caffeine - ==> Removing App '.*/Caffeine.app'. + ==> Removing App '.*Caffeine.app'. EOS expect { -- cgit v1.2.3