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