aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMartin Schimandl2017-10-22 13:43:17 +0200
committerMartin Schimandl2017-11-10 20:16:38 +0100
commit2b261ad4a7d0e29f1708be5ae547c29e22635652 (patch)
tree65cb80e1b03b0800bcf7c439dddb436258cba0c9 /Library
parent5eab54f892cfac39c78a3d092f3084ce817fca04 (diff)
downloadbrew-2b261ad4a7d0e29f1708be5ae547c29e22635652.tar.bz2
Refactor code to reduce characters per line
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb6
-rw-r--r--Library/Homebrew/test/cask/cli/internal_stanza_spec.rb8
2 files changed, 8 insertions, 6 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
index bce5db3e1..b5df67b0f 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/internal_stanza.rb
@@ -45,7 +45,8 @@ module Hbc
@format = :to_yaml if yaml?
return if DSL::DSL_METHODS.include?(stanza)
- raise ArgumentError, "Illegal stanza: '#{stanza}'"
+ raise ArgumentError,
+ "Unknown/unsupported stanza: '#{stanza}' Check cask reference for supported stanzas."
end
def run
@@ -72,7 +73,8 @@ module Hbc
if value.nil? || (value.respond_to?(:to_a) && value.to_a.empty?) ||
(value.respond_to?(:to_s) && value.to_s == "{}")
- raise CaskError, "no such stanza '#{artifact_name ? artifact_name : stanza}' on Cask '#{cask}'"
+ stanza_name = artifact_name ? artifact_name : stanza
+ raise CaskError, "no such stanza '#{stanza_name}' on Cask '#{cask}'"
end
if format
diff --git a/Library/Homebrew/test/cask/cli/internal_stanza_spec.rb b/Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
index 52bbf4ee0..a020b33d4 100644
--- a/Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
+++ b/Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
@@ -6,10 +6,10 @@ describe Hbc::CLI::InternalStanza, :cask do
}.to output("http://example.com/gpg-signature.asc\n").to_stdout
end
- it "raises an exception when stanza is invalid" do
+ it "raises an exception when stanza is unknown/unsupported" do
expect {
- described_class.new("invalid_stanza", "with-gpg")
- }.to raise_error(/Illegal stanza/)
+ described_class.new("this_stanza_does_not_exist", "with-gpg")
+ }.to raise_error(/Unknown\/unsupported stanza/)
end
it "raises an exception when normal stanza is not present on cask" do
@@ -37,6 +37,6 @@ describe Hbc::CLI::InternalStanza, :cask do
command = described_class.new("artifacts", "with-gpg")
expect {
command.run
- }.to output("{:app=>[[\"Caffeine.app\"]]}\n").to_stdout
+ }.to output(/Caffeine\.app/).to_stdout
end
end