From 66ce57530150d05f52c552347ebb7c44679daf44 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 11 Jun 2017 02:00:59 +0200 Subject: 🔨 Refactor Cask exceptions. --- Library/Homebrew/test/cask/cli/install_spec.rb | 6 +++--- Library/Homebrew/test/cask/dsl_spec.rb | 2 +- Library/Homebrew/test/cask/installer_spec.rb | 16 ---------------- Library/Homebrew/test/cask/verify/checksum_spec.rb | 2 +- 4 files changed, 5 insertions(+), 21 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 b1b26c867..0720d0d77 100644 --- a/Library/Homebrew/test/cask/cli/install_spec.rb +++ b/Library/Homebrew/test/cask/cli/install_spec.rb @@ -41,7 +41,7 @@ describe Hbc::CLI::Install, :cask do expect { Hbc::CLI::Install.run("local-transmission") - }.to output(/Warning: A Cask for local-transmission is already installed./).to_stderr + }.to output(/Warning: Cask 'local-transmission' is already installed./).to_stderr end it "allows double install with --force" do @@ -80,7 +80,7 @@ describe Hbc::CLI::Install, :cask do rescue Hbc::CaskError nil end - }.to output(/No available Cask for localcaffeine\. Did you mean:\nlocal-caffeine/).to_stderr + }.to output(/Cask 'localcaffeine' is unavailable\. Did you mean:\nlocal-caffeine/).to_stderr end it "returns multiple suggestions for a Cask fragment" do @@ -90,7 +90,7 @@ describe Hbc::CLI::Install, :cask do rescue Hbc::CaskError nil end - }.to output(/No available Cask for local-caf\. Did you mean one of:\nlocal-caffeine/).to_stderr + }.to output(/Cask 'local-caf' is unavailable\. Did you mean one of:\nlocal-caffeine/).to_stderr end describe "when no Cask is specified" do diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 7eeabcf49..5849f581b 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -57,7 +57,7 @@ describe Hbc::DSL, :cask do it "raises an error" do expect { cask - }.to raise_error(Hbc::CaskTokenDoesNotMatchError, /Bad header line:.*does not match file name/) + }.to raise_error(Hbc::CaskTokenMismatchError, /header line does not match the file name/) end end diff --git a/Library/Homebrew/test/cask/installer_spec.rb b/Library/Homebrew/test/cask/installer_spec.rb index a32f71cab..8ef82c1d5 100644 --- a/Library/Homebrew/test/cask/installer_spec.rb +++ b/Library/Homebrew/test/cask/installer_spec.rb @@ -145,22 +145,6 @@ describe Hbc::Installer, :cask do expect(with_macosx_dir.staged_path.join("__MACOSX")).not_to be_a_directory end - it "installer method raises an exception when already-installed Casks which auto-update are attempted" do - with_auto_updates = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb") - - expect(with_auto_updates).not_to be_installed - - installer = Hbc::Installer.new(with_auto_updates) - - shutup do - installer.install - end - - expect { - installer.install - }.to raise_error(Hbc::CaskAlreadyInstalledAutoUpdatesError) - end - it "allows already-installed Casks which auto-update to be installed if force is provided" do with_auto_updates = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb") diff --git a/Library/Homebrew/test/cask/verify/checksum_spec.rb b/Library/Homebrew/test/cask/verify/checksum_spec.rb index 55c0e5f44..4b8543d2b 100644 --- a/Library/Homebrew/test/cask/verify/checksum_spec.rb +++ b/Library/Homebrew/test/cask/verify/checksum_spec.rb @@ -1,5 +1,5 @@ describe Hbc::Verify::Checksum, :cask do - let(:cask) { double("cask") } + let(:cask) { double("cask", token: "cask") } let(:downloaded_path) { double("downloaded_path") } let(:verification) { described_class.new(cask, downloaded_path) } -- cgit v1.2.3