31 lines
1.1 KiB
Ruby
Raw Normal View History

2017-10-03 10:49:58 +02:00
require_relative "shared_examples/requires_cask_token"
require_relative "shared_examples/invalid_option"
2018-09-04 08:45:48 +01:00
describe Hbc::Cmd::Zap, :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
it "shows an error when a bad Cask is provided" do
2017-10-03 10:49:58 +02:00
expect { described_class.run("notacask") }
.to raise_error(Hbc::CaskUnavailableError, /is unavailable/)
2016-08-18 22:11:42 +03:00
end
it "can zap and unlink multiple Casks at once" do
caffeine = Hbc::CaskLoader.load(cask_path("local-caffeine"))
transmission = Hbc::CaskLoader.load(cask_path("local-transmission"))
2016-08-18 22:11:42 +03:00
2017-07-29 19:55:05 +02:00
Hbc::Installer.new(caffeine).install
Hbc::Installer.new(transmission).install
2016-08-18 22:11:42 +03:00
2017-02-08 13:44:28 +01:00
expect(caffeine).to be_installed
expect(transmission).to be_installed
2016-08-18 22:11:42 +03:00
2017-10-03 10:49:58 +02:00
described_class.run("local-caffeine", "local-transmission")
2016-08-18 22:11:42 +03:00
2017-02-08 13:44:28 +01:00
expect(caffeine).not_to be_installed
2017-12-03 09:06:23 +01:00
expect(Hbc::Config.global.appdir.join("Caffeine.app")).not_to be_a_symlink
2017-02-08 13:44:28 +01:00
expect(transmission).not_to be_installed
2017-12-03 09:06:23 +01:00
expect(Hbc::Config.global.appdir.join("Transmission.app")).not_to be_a_symlink
2016-08-18 22:11:42 +03:00
end
end