combine errors to a single if-statement. fix spec test
This commit is contained in:
parent
99b7636008
commit
dfe4e7641a
@ -71,16 +71,16 @@ module Hbc
|
||||
next
|
||||
end
|
||||
|
||||
if value.nil? || (value.is_a?(Array) && value.empty?)
|
||||
opoo "no such stanza '#{stanza}' on Cask '#{cask}'" unless quiet?
|
||||
puts ""
|
||||
raise ArgumentError, "no such stanza '#{stanza}' on Cask '#{cask}'"
|
||||
end
|
||||
if (value.nil? || value.is_a?(Array) && value.empty?) ||
|
||||
(artifact_name && !value.key?(artifact_name))
|
||||
|
||||
if artifact_name && !value.key?(artifact_name)
|
||||
opoo "no such stanza '#{artifact_name}' on Cask '#{cask}'" unless quiet?
|
||||
puts ""
|
||||
raise ArgumentError, "no such stanza '#{artifact_name}' on Cask '#{cask}'"
|
||||
if artifact_name
|
||||
thing = artifact_name
|
||||
else
|
||||
thing = stanza
|
||||
end
|
||||
|
||||
raise CaskError, "no such stanza '#{thing}' on Cask '#{cask}'"
|
||||
end
|
||||
|
||||
if stanza == :artifacts
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
describe Hbc::CLI::InternalStanza, :cask do
|
||||
it "shows stanza of the Specified Cask" do
|
||||
command = described_class.new("gpg", "with-gpg")
|
||||
command.run
|
||||
# TODO: check result
|
||||
expect do
|
||||
command.run
|
||||
end.to output("http://example.com/gpg-signature.asc\n").to_stdout
|
||||
end
|
||||
|
||||
it "raises an exception when stanza is invalid" do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user