aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
diff options
context:
space:
mode:
authorMarkus Reiter2017-11-20 21:41:48 +0100
committerGitHub2017-11-20 21:41:48 +0100
commit236b0172306a6f4b233d374fcc20adce5c3e3261 (patch)
treef9bc411e42ba88586abbc57ec0479ad0914b4264 /Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
parentc458c902369d039acb818e9f71393084a33df491 (diff)
parent17e001bd306e5cedd207475985052205b6ddeac6 (diff)
downloadbrew-1.3.8.tar.bz2
Merge pull request #3258 from Git-Jiro/improve_internal_stanza_command1.3.8
improve 'brew cask _stanza' by checking for known stanzas
Diffstat (limited to 'Library/Homebrew/test/cask/cli/internal_stanza_spec.rb')
-rw-r--r--Library/Homebrew/test/cask/cli/internal_stanza_spec.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cask/cli/internal_stanza_spec.rb b/Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
new file mode 100644
index 000000000..47b0fd8b3
--- /dev/null
+++ b/Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
@@ -0,0 +1,42 @@
+describe Hbc::CLI::InternalStanza, :cask do
+ it "shows stanza of the Specified Cask" do
+ command = described_class.new("gpg", "with-gpg")
+ expect {
+ command.run
+ }.to output("http://example.com/gpg-signature.asc\n").to_stdout
+ end
+
+ it "raises an exception when stanza is unknown/unsupported" do
+ expect {
+ described_class.new("this_stanza_does_not_exist", "with-gpg")
+ }.to raise_error(%r{Unknown/unsupported stanza})
+ end
+
+ it "raises an exception when normal stanza is not present on cask" do
+ command = described_class.new("caveats", "with-gpg")
+ expect {
+ command.run
+ }.to raise_error(/no such stanza/)
+ end
+
+ it "raises an exception when artifact stanza is not present on cask" do
+ command = described_class.new("zap", "with-gpg")
+ expect {
+ command.run
+ }.to raise_error(/no such stanza/)
+ end
+
+ it "raises an exception when 'depends_on' stanza is not present on cask" do
+ command = described_class.new("depends_on", "with-gpg")
+ expect {
+ command.run
+ }.to raise_error(/no such stanza/)
+ end
+
+ it "shows all artifact stanzas when using 'artifacts' keyword" do
+ command = described_class.new("artifacts", "with-gpg")
+ expect {
+ command.run
+ }.to output(/Caffeine\.app/).to_stdout
+ end
+end