homebrew-cask-versions/test/cask/cli/cat_test.rb
Roland Walker 5ae6e2f773 doc new app stanza and update tests to use it
Replacing `link` for almost all cases.

The `link` stanza can still appear in error messages, because
under the hood, `app` is still implemented as a pure synonym
for the `link` artifact.  That will change automatically when
we factor into separate artifacts.
2014-09-13 13:03:46 -04:00

43 lines
1.2 KiB
Ruby

require 'test_helper'
describe Cask::CLI::Cat do
it 'displays the cask file content about the specified cask' do
lambda {
Cask::CLI::Cat.run('basic-cask')
}.must_output <<-CLIOUTPUT.undent
class BasicCask < TestCask
url 'http://example.com/TestCask.dmg'
homepage 'http://example.com/'
version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
app 'TestCask.app'
end
CLIOUTPUT
end
it 'throws away additional arguments and uses the first' do
lambda{
Cask::CLI::Cat.run('basic-cask', 'local-caffeine')
}.must_output <<-CLIOUTPUT.undent
class BasicCask < TestCask
url 'http://example.com/TestCask.dmg'
homepage 'http://example.com/'
version '1.2.3'
sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
app 'TestCask.app'
end
CLIOUTPUT
end
it %q{raises an exception when the cask doesn't exist} do
lambda {
Cask::CLI::Cat.run('notacask')
}.must_raise CaskUnavailableError
end
it "raises an exception when no cask is specified" do
lambda {
Cask::CLI::Cat.run
}.must_raise CaskUnspecifiedError
end
end