Change behaviour of 'cask _stanza' command. Add tests for 'cask _stanza' command
This commit is contained in:
parent
be68f3d7b4
commit
ff2239509d
@ -71,10 +71,16 @@ module Hbc
|
||||
next
|
||||
end
|
||||
|
||||
if value == nil || (value.kind_of?(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 artifact_name && !value.key?(artifact_name)
|
||||
opoo "no such stanza '#{artifact_name}' on Cask '#{cask}'" unless quiet?
|
||||
puts ""
|
||||
next
|
||||
raise ArgumentError, "no such stanza '#{artifact_name}' on Cask '#{cask}'"
|
||||
end
|
||||
|
||||
if stanza == :artifacts
|
||||
|
||||
28
Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
Normal file
28
Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
Normal file
@ -0,0 +1,28 @@
|
||||
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
|
||||
end
|
||||
|
||||
it "raises an exception when stanza is invalid" do
|
||||
expect {
|
||||
described_class.new("invalid_stanza", "with-gpg");
|
||||
}.to raise_error(/Illegal 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
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user