Refactor code to reduce characters per line
This commit is contained in:
parent
5eab54f892
commit
2b261ad4a7
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user