43 lines
1.2 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2017-10-03 10:49:58 +02:00
require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option"
2018-09-06 08:29:14 +02:00
describe Cask::Cmd::Cat, :cask do
2017-10-03 10:49:58 +02:00
it_behaves_like "a command that requires a Cask token"
it_behaves_like "a command that handles invalid options"
2016-08-18 22:11:42 +03:00
describe "given a basic Cask" do
2017-05-21 02:32:46 +02:00
let(:basic_cask_content) {
2018-07-11 15:17:40 +02:00
<<~RUBY
cask "basic-cask" do
version "1.2.3"
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
2016-08-18 22:11:42 +03:00
url "https://brew.sh/TestCask.dmg"
homepage "https://brew.sh/"
2016-08-18 22:11:42 +03:00
app "TestCask.app"
2016-08-18 22:11:42 +03:00
end
2018-07-11 15:17:40 +02:00
RUBY
2017-02-08 12:01:03 +01:00
}
2016-08-18 22:11:42 +03:00
it "displays the Cask file content about the specified Cask" do
2017-02-08 12:01:03 +01:00
expect {
2017-10-03 10:49:58 +02:00
described_class.run("basic-cask")
2017-05-21 02:32:46 +02:00
}.to output(basic_cask_content).to_stdout
2016-08-18 22:11:42 +03:00
end
2017-05-21 02:32:46 +02:00
it "can display multiple Casks" do
2017-02-08 12:01:03 +01:00
expect {
2017-10-03 10:49:58 +02:00
described_class.run("basic-cask", "basic-cask")
2017-05-21 02:32:46 +02:00
}.to output(basic_cask_content * 2).to_stdout
2016-08-18 22:11:42 +03:00
end
end
it "raises an exception when the Cask does not exist" do
2017-10-03 10:49:58 +02:00
expect { described_class.run("notacask") }
2018-09-06 08:29:14 +02:00
.to raise_error(Cask::CaskUnavailableError, /is unavailable/)
2016-08-18 22:11:42 +03:00
end
end