59 lines
1.6 KiB
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: false
# 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) {
2020-12-11 21:58:09 +01:00
<<~'RUBY'
cask "basic-cask" do
version "1.2.3"
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
2016-08-18 22:11:42 +03:00
2020-12-11 21:58:09 +01:00
url "https://brew.sh/TestCask-#{version}.dmg"
2020-09-14 04:17:50 +02:00
name "Basic Cask"
desc "Cask for testing basic functionality"
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
}
2020-09-29 23:46:30 +02:00
let(:caffeine_content) {
<<~'RUBY'
cask "local-caffeine" do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage "https://brew.sh/"
app "Caffeine.app"
end
RUBY
}
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 {
2020-09-29 23:46:30 +02:00
described_class.run("basic-cask", "local-caffeine")
}.to output(basic_cask_content + caffeine_content).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