aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cask/cli
diff options
context:
space:
mode:
authorMarkus Reiter2017-06-13 17:14:01 +0200
committerMarkus Reiter2017-06-13 19:45:29 +0200
commit9c8f7138f35625878e017559c896441fda6f357c (patch)
tree413c4d77a58c9cab4e57e5155bb5022d5d248e4d /Library/Homebrew/test/cask/cli
parent66ce57530150d05f52c552347ebb7c44679daf44 (diff)
downloadbrew-9c8f7138f35625878e017559c896441fda6f357c.tar.bz2
Add `casks` method to iterate through arguments.
Diffstat (limited to 'Library/Homebrew/test/cask/cli')
-rw-r--r--Library/Homebrew/test/cask/cli/audit_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/cli/cat_spec.rb6
-rw-r--r--Library/Homebrew/test/cask/cli/fetch_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/cli/install_spec.rb6
-rw-r--r--Library/Homebrew/test/cask/cli/style_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/cli/uninstall_spec.rb20
-rw-r--r--Library/Homebrew/test/cask/cli/zap_spec.rb6
7 files changed, 21 insertions, 23 deletions
diff --git a/Library/Homebrew/test/cask/cli/audit_spec.rb b/Library/Homebrew/test/cask/cli/audit_spec.rb
index 412db1481..01f506c8c 100644
--- a/Library/Homebrew/test/cask/cli/audit_spec.rb
+++ b/Library/Homebrew/test/cask/cli/audit_spec.rb
@@ -1,5 +1,5 @@
describe Hbc::CLI::Audit, :cask do
- let(:cask) { double }
+ let(:cask) { double("cask", token: nil) }
describe "selection of Casks to audit" do
it "audits all Casks if no tokens are given" do
diff --git a/Library/Homebrew/test/cask/cli/cat_spec.rb b/Library/Homebrew/test/cask/cli/cat_spec.rb
index 28089b2f1..b726a0b36 100644
--- a/Library/Homebrew/test/cask/cli/cat_spec.rb
+++ b/Library/Homebrew/test/cask/cli/cat_spec.rb
@@ -34,9 +34,9 @@ describe Hbc::CLI::Cat, :cask do
end
it "raises an exception when the Cask does not exist" do
- expect {
- Hbc::CLI::Cat.run("notacask")
- }.to raise_error(Hbc::CaskUnavailableError)
+ expect { Hbc::CLI::Cat.run("notacask") }
+ .to output(/is unavailable/).to_stderr
+ .and raise_error(Hbc::CaskError, "Cat incomplete.")
end
describe "when no Cask is specified" do
diff --git a/Library/Homebrew/test/cask/cli/fetch_spec.rb b/Library/Homebrew/test/cask/cli/fetch_spec.rb
index 9f3056631..54bdfc0c8 100644
--- a/Library/Homebrew/test/cask/cli/fetch_spec.rb
+++ b/Library/Homebrew/test/cask/cli/fetch_spec.rb
@@ -54,7 +54,7 @@ describe Hbc::CLI::Fetch, :cask do
shutup do
Hbc::CLI::Fetch.run("notacask")
end
- }.to raise_error(Hbc::CaskUnavailableError)
+ }.to raise_error(Hbc::CaskError, "Fetch incomplete.")
end
describe "when no Cask is specified" do
diff --git a/Library/Homebrew/test/cask/cli/install_spec.rb b/Library/Homebrew/test/cask/cli/install_spec.rb
index 0720d0d77..cf69b5d86 100644
--- a/Library/Homebrew/test/cask/cli/install_spec.rb
+++ b/Library/Homebrew/test/cask/cli/install_spec.rb
@@ -70,7 +70,7 @@ describe Hbc::CLI::Install, :cask do
shutup do
Hbc::CLI::Install.run("notacask")
end
- }.to raise_error(Hbc::CaskError)
+ }.to raise_error(Hbc::CaskError, "Install incomplete.")
end
it "returns a suggestion for a misspelled Cask" do
@@ -80,7 +80,7 @@ describe Hbc::CLI::Install, :cask do
rescue Hbc::CaskError
nil
end
- }.to output(/Cask 'localcaffeine' is unavailable\. Did you mean:\nlocal-caffeine/).to_stderr
+ }.to output(/Cask 'localcaffeine' is unavailable: No Cask with this name exists\. 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(/Cask 'local-caf' is unavailable\. Did you mean one of:\nlocal-caffeine/).to_stderr
+ }.to output(/Cask 'local-caf' is unavailable: No Cask with this name exists\. Did you mean one of:\nlocal-caffeine/).to_stderr
end
describe "when no Cask is specified" do
diff --git a/Library/Homebrew/test/cask/cli/style_spec.rb b/Library/Homebrew/test/cask/cli/style_spec.rb
index a5dcf6f6f..640eca5f4 100644
--- a/Library/Homebrew/test/cask/cli/style_spec.rb
+++ b/Library/Homebrew/test/cask/cli/style_spec.rb
@@ -107,7 +107,7 @@ describe Hbc::CLI::Style, :cask do
end
it "tries to find paths for all tokens" do
- expect(Hbc::CaskLoader).to receive(:path).twice
+ expect(Hbc::CaskLoader).to receive(:load).twice.and_return(double("cask", sourcefile_path: nil))
subject
end
end
diff --git a/Library/Homebrew/test/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb
index bc1f52613..cc640fad7 100644
--- a/Library/Homebrew/test/cask/cli/uninstall_spec.rb
+++ b/Library/Homebrew/test/cask/cli/uninstall_spec.rb
@@ -17,15 +17,15 @@ describe Hbc::CLI::Uninstall, :cask do
end
it "shows an error when a bad Cask is provided" do
- expect {
- Hbc::CLI::Uninstall.run("notacask")
- }.to raise_error(Hbc::CaskUnavailableError)
+ expect { Hbc::CLI::Uninstall.run("notacask") }
+ .to output(/is unavailable/).to_stderr
+ .and raise_error(Hbc::CaskError, "Uninstall incomplete.")
end
it "shows an error when a Cask is provided that's not installed" do
- expect {
- Hbc::CLI::Uninstall.run("local-caffeine")
- }.to raise_error(Hbc::CaskNotInstalledError)
+ expect { Hbc::CLI::Uninstall.run("local-caffeine") }
+ .to output(/is not installed/).to_stderr
+ .and raise_error(Hbc::CaskError, "Uninstall incomplete.")
end
it "tries anyway on a non-present Cask when --force is given" do
@@ -89,11 +89,9 @@ describe Hbc::CLI::Uninstall, :cask do
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 { shutup { Hbc::CLI::Uninstall.run("with-uninstall-script-app") } }
+ .to output(/does not exist/).to_stderr
+ .and raise_error(Hbc::CaskError, "Uninstall incomplete.")
expect(cask).to be_installed
diff --git a/Library/Homebrew/test/cask/cli/zap_spec.rb b/Library/Homebrew/test/cask/cli/zap_spec.rb
index f3af0e66f..e39ca61f8 100644
--- a/Library/Homebrew/test/cask/cli/zap_spec.rb
+++ b/Library/Homebrew/test/cask/cli/zap_spec.rb
@@ -1,8 +1,8 @@
describe Hbc::CLI::Zap, :cask do
it "shows an error when a bad Cask is provided" do
- expect {
- Hbc::CLI::Zap.run("notacask")
- }.to raise_error(Hbc::CaskUnavailableError)
+ expect { Hbc::CLI::Zap.run("notacask") }
+ .to output(/is unavailable/).to_stderr
+ .and raise_error(Hbc::CaskError, "Zap incomplete.")
end
it "can zap and unlink multiple Casks at once" do