brew/Library/Homebrew/test/cask/cli/internal_stanza_spec.rb
Martin Schimandl db2c86204b internal_stanza.rb: Remove obsolete code. Improve detection of missing stanzas
internal_stanza_spec.rb: change do ... end blocks to { } blocks
2017-11-10 20:16:38 +01:00

43 lines
1.2 KiB
Ruby

describe Hbc::CLI::InternalStanza, :cask do
it "shows stanza of the Specified Cask" do
command = described_class.new("gpg", "with-gpg")
expect {
command.run
}.to output("http://example.com/gpg-signature.asc\n").to_stdout
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
it "raises an exception when 'depends_on' stanza is not present on cask" do
command = described_class.new("depends_on", "with-gpg")
expect {
command.run
}.to raise_error(/no such stanza/)
end
it "shows all artifact stanzas when using 'artifacts' keyword" do
command = described_class.new("artifacts", "with-gpg")
expect {
command.run
}.to output("{:app=>[[\"Caffeine.app\"]]}\n").to_stdout
end
end