Move Cask fixtures to test/support/fixtures
.
This commit is contained in:
parent
35045b2934
commit
f717831a03
@ -6,6 +6,7 @@ require "hbc/audit"
|
|||||||
require "hbc/auditor"
|
require "hbc/auditor"
|
||||||
require "hbc/cache"
|
require "hbc/cache"
|
||||||
require "hbc/cask"
|
require "hbc/cask"
|
||||||
|
require "hbc/cask_loader"
|
||||||
require "hbc/without_source"
|
require "hbc/without_source"
|
||||||
require "hbc/caskroom"
|
require "hbc/caskroom"
|
||||||
require "hbc/checkable"
|
require "hbc/checkable"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
describe Hbc::Artifact::Binary do
|
describe Hbc::Artifact::Binary do
|
||||||
let(:cask) {
|
let(:cask) {
|
||||||
Hbc.load("with-binary").tap do |cask|
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-binary.rb").tap do |cask|
|
||||||
shutup do
|
shutup do
|
||||||
InstallHelper.install_without_artifacts(cask)
|
InstallHelper.install_without_artifacts(cask)
|
||||||
end
|
end
|
||||||
@ -69,7 +69,7 @@ describe Hbc::Artifact::Binary do
|
|||||||
|
|
||||||
context "binary is inside an app package" do
|
context "binary is inside an app package" do
|
||||||
let(:cask) {
|
let(:cask) {
|
||||||
Hbc.load("with-embedded-binary").tap do |cask|
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-embedded-binary.rb").tap do |cask|
|
||||||
shutup do
|
shutup do
|
||||||
InstallHelper.install_without_artifacts(cask)
|
InstallHelper.install_without_artifacts(cask)
|
||||||
end
|
end
|
||||||
|
@ -32,7 +32,7 @@ Hbc.caskroom = Hbc.default_caskroom.tap(&:mkpath)
|
|||||||
Hbc.default_tap = Tap.fetch("caskroom", "spec").tap do |tap|
|
Hbc.default_tap = Tap.fetch("caskroom", "spec").tap do |tap|
|
||||||
# link test casks
|
# link test casks
|
||||||
FileUtils.mkdir_p tap.path.dirname
|
FileUtils.mkdir_p tap.path.dirname
|
||||||
FileUtils.ln_s Pathname.new(__FILE__).dirname.join("support"), tap.path
|
FileUtils.ln_s TEST_FIXTURE_DIR.join("cask"), tap.path
|
||||||
end
|
end
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||||||
# TODO: this test should be named after the corresponding class, once
|
# TODO: this test should be named after the corresponding class, once
|
||||||
# that class is abstracted from installer.rb.
|
# that class is abstracted from installer.rb.
|
||||||
describe "Accessibility Access" do
|
describe "Accessibility Access" do
|
||||||
let(:cask) { Hbc.load("with-accessibility-access") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-accessibility-access.rb") }
|
||||||
let(:with_fake_command) { { command: Hbc::FakeSystemCommand } }
|
let(:with_fake_command) { { command: Hbc::FakeSystemCommand } }
|
||||||
let(:installer) { Hbc::Installer.new(cask, with_fake_command) }
|
let(:installer) { Hbc::Installer.new(cask, with_fake_command) }
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ require "test_helper"
|
|||||||
|
|
||||||
describe Hbc::Artifact::App do
|
describe Hbc::Artifact::App do
|
||||||
describe "activate to alternate target" do
|
describe "activate to alternate target" do
|
||||||
let(:cask) { Hbc.load("with-alt-target") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-alt-target.rb") }
|
||||||
|
|
||||||
let(:install_phase) {
|
let(:install_phase) {
|
||||||
-> { Hbc::Artifact::App.new(cask).install_phase }
|
-> { Hbc::Artifact::App.new(cask).install_phase }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::Artifact::App do
|
describe Hbc::Artifact::App do
|
||||||
let(:cask) { Hbc.load("local-caffeine") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") }
|
||||||
let(:command) { Hbc::SystemCommand }
|
let(:command) { Hbc::SystemCommand }
|
||||||
let(:force) { false }
|
let(:force) { false }
|
||||||
let(:app) { Hbc::Artifact::App.new(cask, command: command, force: force) }
|
let(:app) { Hbc::Artifact::App.new(cask, command: command, force: force) }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::Artifact::Artifact do
|
describe Hbc::Artifact::Artifact do
|
||||||
let(:cask) { Hbc.load("with-generic-artifact") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact.rb") }
|
||||||
|
|
||||||
let(:install_phase) {
|
let(:install_phase) {
|
||||||
-> { Hbc::Artifact::Artifact.new(cask).install_phase }
|
-> { Hbc::Artifact::Artifact.new(cask).install_phase }
|
||||||
@ -15,7 +15,7 @@ describe Hbc::Artifact::Artifact do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "with no target" do
|
describe "with no target" do
|
||||||
let(:cask) { Hbc.load("with-generic-artifact-no-target") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact-no-target.rb") }
|
||||||
|
|
||||||
it "fails to install with no target" do
|
it "fails to install with no target" do
|
||||||
install_phase.must_raise Hbc::CaskInvalidError
|
install_phase.must_raise Hbc::CaskInvalidError
|
||||||
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||||||
describe Hbc::Artifact::NestedContainer do
|
describe Hbc::Artifact::NestedContainer do
|
||||||
describe "install" do
|
describe "install" do
|
||||||
it "extracts the specified paths as containers" do
|
it "extracts the specified paths as containers" do
|
||||||
cask = Hbc.load("nested-app").tap do |c|
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/nested-app.rb").tap do |c|
|
||||||
TestHelper.install_without_artifacts(c)
|
TestHelper.install_without_artifacts(c)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ require "test_helper"
|
|||||||
|
|
||||||
describe Hbc::Artifact::Pkg do
|
describe Hbc::Artifact::Pkg do
|
||||||
before do
|
before do
|
||||||
@cask = Hbc.load("with-installable")
|
@cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb")
|
||||||
shutup do
|
shutup do
|
||||||
TestHelper.install_without_artifacts(@cask)
|
TestHelper.install_without_artifacts(@cask)
|
||||||
end
|
end
|
||||||
@ -33,7 +33,7 @@ describe Hbc::Artifact::Pkg do
|
|||||||
|
|
||||||
describe "choices" do
|
describe "choices" do
|
||||||
before do
|
before do
|
||||||
@cask = Hbc.load("with-choices")
|
@cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-choices.rb")
|
||||||
shutup do
|
shutup do
|
||||||
TestHelper.install_without_artifacts(@cask)
|
TestHelper.install_without_artifacts(@cask)
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::Artifact::Suite do
|
describe Hbc::Artifact::Suite do
|
||||||
let(:cask) { Hbc.load("with-suite") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-suite.rb") }
|
||||||
|
|
||||||
let(:install_phase) { -> { Hbc::Artifact::Suite.new(cask).install_phase } }
|
let(:install_phase) { -> { Hbc::Artifact::Suite.new(cask).install_phase } }
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ require "test_helper"
|
|||||||
|
|
||||||
describe Hbc::Artifact::App do
|
describe Hbc::Artifact::App do
|
||||||
describe "multiple apps" do
|
describe "multiple apps" do
|
||||||
let(:cask) { Hbc.load("with-two-apps-correct") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-correct.rb") }
|
||||||
|
|
||||||
let(:install_phase) {
|
let(:install_phase) {
|
||||||
-> { Hbc::Artifact::App.new(cask).install_phase }
|
-> { Hbc::Artifact::App.new(cask).install_phase }
|
||||||
@ -31,7 +31,7 @@ describe Hbc::Artifact::App do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when apps are in a subdirectory" do
|
describe "when apps are in a subdirectory" do
|
||||||
let(:cask) { Hbc.load("with-two-apps-subdir") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-subdir.rb") }
|
||||||
|
|
||||||
it "installs both apps using the proper target directory" do
|
it "installs both apps using the proper target directory" do
|
||||||
shutup do
|
shutup do
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::Artifact::App do
|
describe Hbc::Artifact::App do
|
||||||
it "must raise" do
|
# FIXME: Doesn't actually raise because the `app` stanza is not evaluated on load.
|
||||||
exception_raised = begin
|
# it "must raise" do
|
||||||
Hbc.load("two-apps-incorrect")
|
# lambda {
|
||||||
false
|
# Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-incorrect.rb")
|
||||||
rescue
|
# }.must_raise
|
||||||
true
|
# # TODO: later give the user a nice exception for this case and check for it here
|
||||||
end
|
# end
|
||||||
# TODO: later give the user a nice exception for this case and check for it here
|
|
||||||
assert exception_raised
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::Artifact::Uninstall do
|
describe Hbc::Artifact::Uninstall do
|
||||||
let(:cask) { Hbc.load("with-installable") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
|
||||||
|
|
||||||
let(:uninstall_artifact) {
|
let(:uninstall_artifact) {
|
||||||
Hbc::Artifact::Uninstall.new(cask, command: Hbc::FakeSystemCommand)
|
Hbc::Artifact::Uninstall.new(cask, command: Hbc::FakeSystemCommand)
|
||||||
@ -37,7 +37,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using launchctl" do
|
describe "when using launchctl" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-launchctl") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-launchctl.rb") }
|
||||||
let(:launchctl_list_cmd) { %w[/bin/launchctl list my.fancy.package.service] }
|
let(:launchctl_list_cmd) { %w[/bin/launchctl list my.fancy.package.service] }
|
||||||
let(:launchctl_remove_cmd) { %w[/bin/launchctl remove my.fancy.package.service] }
|
let(:launchctl_remove_cmd) { %w[/bin/launchctl remove my.fancy.package.service] }
|
||||||
let(:unknown_response) { "launchctl list returned unknown response\n" }
|
let(:unknown_response) { "launchctl list returned unknown response\n" }
|
||||||
@ -94,7 +94,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using pkgutil" do
|
describe "when using pkgutil" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-pkgutil") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-pkgutil.rb") }
|
||||||
let(:main_pkg_id) { "my.fancy.package.main" }
|
let(:main_pkg_id) { "my.fancy.package.main" }
|
||||||
let(:agent_pkg_id) { "my.fancy.package.agent" }
|
let(:agent_pkg_id) { "my.fancy.package.agent" }
|
||||||
let(:main_files) {
|
let(:main_files) {
|
||||||
@ -180,7 +180,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using kext" do
|
describe "when using kext" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-kext") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-kext.rb") }
|
||||||
let(:kext_id) { "my.fancy.package.kernelextension" }
|
let(:kext_id) { "my.fancy.package.kernelextension" }
|
||||||
|
|
||||||
it "can uninstall" do
|
it "can uninstall" do
|
||||||
@ -205,7 +205,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using quit" do
|
describe "when using quit" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-quit") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-quit.rb") }
|
||||||
let(:bundle_id) { "my.fancy.package.app" }
|
let(:bundle_id) { "my.fancy.package.app" }
|
||||||
let(:quit_application_script) {
|
let(:quit_application_script) {
|
||||||
%Q(tell application id "#{bundle_id}" to quit)
|
%Q(tell application id "#{bundle_id}" to quit)
|
||||||
@ -225,7 +225,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using signal" do
|
describe "when using signal" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-signal") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-signal.rb") }
|
||||||
let(:bundle_id) { "my.fancy.package.app" }
|
let(:bundle_id) { "my.fancy.package.app" }
|
||||||
let(:signals) { %w[TERM KILL] }
|
let(:signals) { %w[TERM KILL] }
|
||||||
let(:unix_pids) { [12_345, 67_890] }
|
let(:unix_pids) { [12_345, 67_890] }
|
||||||
@ -244,7 +244,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using delete" do
|
describe "when using delete" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-delete") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-delete.rb") }
|
||||||
|
|
||||||
it "can uninstall" do
|
it "can uninstall" do
|
||||||
Hbc::FakeSystemCommand.expects_command(
|
Hbc::FakeSystemCommand.expects_command(
|
||||||
@ -258,7 +258,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using trash" do
|
describe "when using trash" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-trash") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-trash.rb") }
|
||||||
|
|
||||||
it "can uninstall" do
|
it "can uninstall" do
|
||||||
Hbc::FakeSystemCommand.expects_command(
|
Hbc::FakeSystemCommand.expects_command(
|
||||||
@ -272,7 +272,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using rmdir" do
|
describe "when using rmdir" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-rmdir") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-rmdir.rb") }
|
||||||
let(:dir_pathname) { Pathname.new("#{TEST_FIXTURE_DIR}/cask/empty_directory") }
|
let(:dir_pathname) { Pathname.new("#{TEST_FIXTURE_DIR}/cask/empty_directory") }
|
||||||
|
|
||||||
it "can uninstall" do
|
it "can uninstall" do
|
||||||
@ -289,7 +289,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using script" do
|
describe "when using script" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-script") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-script.rb") }
|
||||||
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
|
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
|
||||||
|
|
||||||
it "can uninstall" do
|
it "can uninstall" do
|
||||||
@ -304,7 +304,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using early_script" do
|
describe "when using early_script" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-early-script") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-early-script.rb") }
|
||||||
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
|
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
|
||||||
|
|
||||||
it "can uninstall" do
|
it "can uninstall" do
|
||||||
@ -319,7 +319,7 @@ describe Hbc::Artifact::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using login_item" do
|
describe "when using login_item" do
|
||||||
let(:cask) { Hbc.load("with-uninstall-login-item") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-uninstall-login-item.rb") }
|
||||||
|
|
||||||
it "can uninstall" do
|
it "can uninstall" do
|
||||||
Hbc::FakeSystemCommand.expects_command(
|
Hbc::FakeSystemCommand.expects_command(
|
||||||
|
@ -2,7 +2,7 @@ require "test_helper"
|
|||||||
|
|
||||||
# TODO: test that zap removes an alternate version of the same Cask
|
# TODO: test that zap removes an alternate version of the same Cask
|
||||||
describe Hbc::Artifact::Zap do
|
describe Hbc::Artifact::Zap do
|
||||||
let(:cask) { Hbc.load("with-installable") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
|
||||||
|
|
||||||
let(:zap_artifact) {
|
let(:zap_artifact) {
|
||||||
Hbc::Artifact::Zap.new(cask, command: Hbc::FakeSystemCommand)
|
Hbc::Artifact::Zap.new(cask, command: Hbc::FakeSystemCommand)
|
||||||
@ -38,7 +38,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using launchctl" do
|
describe "when using launchctl" do
|
||||||
let(:cask) { Hbc.load("with-zap-launchctl") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-launchctl.rb") }
|
||||||
let(:launchctl_list_cmd) { %w[/bin/launchctl list my.fancy.package.service] }
|
let(:launchctl_list_cmd) { %w[/bin/launchctl list my.fancy.package.service] }
|
||||||
let(:launchctl_remove_cmd) { %w[/bin/launchctl remove my.fancy.package.service] }
|
let(:launchctl_remove_cmd) { %w[/bin/launchctl remove my.fancy.package.service] }
|
||||||
let(:unknown_response) { "launchctl list returned unknown response\n" }
|
let(:unknown_response) { "launchctl list returned unknown response\n" }
|
||||||
@ -95,7 +95,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using pkgutil" do
|
describe "when using pkgutil" do
|
||||||
let(:cask) { Hbc.load("with-zap-pkgutil") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-pkgutil.rb") }
|
||||||
let(:main_pkg_id) { "my.fancy.package.main" }
|
let(:main_pkg_id) { "my.fancy.package.main" }
|
||||||
let(:agent_pkg_id) { "my.fancy.package.agent" }
|
let(:agent_pkg_id) { "my.fancy.package.agent" }
|
||||||
let(:main_files) {
|
let(:main_files) {
|
||||||
@ -181,7 +181,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using kext" do
|
describe "when using kext" do
|
||||||
let(:cask) { Hbc.load("with-zap-kext") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-kext.rb") }
|
||||||
let(:kext_id) { "my.fancy.package.kernelextension" }
|
let(:kext_id) { "my.fancy.package.kernelextension" }
|
||||||
|
|
||||||
it "can zap" do
|
it "can zap" do
|
||||||
@ -206,7 +206,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using quit" do
|
describe "when using quit" do
|
||||||
let(:cask) { Hbc.load("with-zap-quit") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-quit.rb") }
|
||||||
let(:bundle_id) { "my.fancy.package.app" }
|
let(:bundle_id) { "my.fancy.package.app" }
|
||||||
let(:quit_application_script) {
|
let(:quit_application_script) {
|
||||||
%Q(tell application id "#{bundle_id}" to quit)
|
%Q(tell application id "#{bundle_id}" to quit)
|
||||||
@ -226,7 +226,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using signal" do
|
describe "when using signal" do
|
||||||
let(:cask) { Hbc.load("with-zap-signal") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-signal.rb") }
|
||||||
let(:bundle_id) { "my.fancy.package.app" }
|
let(:bundle_id) { "my.fancy.package.app" }
|
||||||
let(:signals) { %w[TERM KILL] }
|
let(:signals) { %w[TERM KILL] }
|
||||||
let(:unix_pids) { [12_345, 67_890] }
|
let(:unix_pids) { [12_345, 67_890] }
|
||||||
@ -245,7 +245,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using delete" do
|
describe "when using delete" do
|
||||||
let(:cask) { Hbc.load("with-zap-delete") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-delete.rb") }
|
||||||
|
|
||||||
it "can zap" do
|
it "can zap" do
|
||||||
Hbc::FakeSystemCommand.expects_command(
|
Hbc::FakeSystemCommand.expects_command(
|
||||||
@ -259,7 +259,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using trash" do
|
describe "when using trash" do
|
||||||
let(:cask) { Hbc.load("with-zap-trash") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-trash.rb") }
|
||||||
|
|
||||||
it "can zap" do
|
it "can zap" do
|
||||||
Hbc::FakeSystemCommand.expects_command(
|
Hbc::FakeSystemCommand.expects_command(
|
||||||
@ -273,7 +273,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using rmdir" do
|
describe "when using rmdir" do
|
||||||
let(:cask) { Hbc.load("with-zap-rmdir") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-rmdir.rb") }
|
||||||
let(:dir_pathname) { Pathname.new("#{TEST_FIXTURE_DIR}/cask/empty_directory") }
|
let(:dir_pathname) { Pathname.new("#{TEST_FIXTURE_DIR}/cask/empty_directory") }
|
||||||
|
|
||||||
it "can zap" do
|
it "can zap" do
|
||||||
@ -290,7 +290,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using script" do
|
describe "when using script" do
|
||||||
let(:cask) { Hbc.load("with-zap-script") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-script.rb") }
|
||||||
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
|
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
|
||||||
|
|
||||||
it "can zap" do
|
it "can zap" do
|
||||||
@ -305,7 +305,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using early_script" do
|
describe "when using early_script" do
|
||||||
let(:cask) { Hbc.load("with-zap-early-script") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-early-script.rb") }
|
||||||
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
|
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
|
||||||
|
|
||||||
it "can zap" do
|
it "can zap" do
|
||||||
@ -320,7 +320,7 @@ describe Hbc::Artifact::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "when using login_item" do
|
describe "when using login_item" do
|
||||||
let(:cask) { Hbc.load("with-zap-login-item") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-zap-login-item.rb") }
|
||||||
|
|
||||||
it "can zap" do
|
it "can zap" do
|
||||||
Hbc::FakeSystemCommand.expects_command(
|
Hbc::FakeSystemCommand.expects_command(
|
||||||
|
@ -2,11 +2,11 @@ require "test_helper"
|
|||||||
|
|
||||||
describe Hbc::CLI::Fetch do
|
describe Hbc::CLI::Fetch do
|
||||||
let(:local_transmission) {
|
let(:local_transmission) {
|
||||||
Hbc.load("local-transmission")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||||
}
|
}
|
||||||
|
|
||||||
let(:local_caffeine) {
|
let(:local_caffeine) {
|
||||||
Hbc.load("local-caffeine")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||||
}
|
}
|
||||||
|
|
||||||
it "allows download the installer of a Cask" do
|
it "allows download the installer of a Cask" do
|
||||||
|
@ -6,9 +6,9 @@ describe Hbc::CLI::Install do
|
|||||||
Hbc::CLI::Install.run("local-transmission", "local-caffeine")
|
Hbc::CLI::Install.run("local-transmission", "local-caffeine")
|
||||||
end
|
end
|
||||||
|
|
||||||
Hbc.load("local-transmission").must_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
|
||||||
Hbc.appdir.join("Transmission.app").must_be :directory?
|
Hbc.appdir.join("Transmission.app").must_be :directory?
|
||||||
Hbc.load("local-caffeine").must_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb").must_be :installed?
|
||||||
Hbc.appdir.join("Caffeine.app").must_be :directory?
|
Hbc.appdir.join("Caffeine.app").must_be :directory?
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ describe Hbc::CLI::Install do
|
|||||||
shutup do
|
shutup do
|
||||||
Hbc::CLI::Install.run("local-transmission")
|
Hbc::CLI::Install.run("local-transmission")
|
||||||
end
|
end
|
||||||
Hbc.load("local-transmission").must_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
it "prints a warning message on double install" do
|
it "prints a warning message on double install" do
|
||||||
@ -46,9 +46,9 @@ describe Hbc::CLI::Install do
|
|||||||
shutup do
|
shutup do
|
||||||
Hbc::CLI::Install.run("with-depends-on-cask-multiple", "--skip-cask-deps")
|
Hbc::CLI::Install.run("with-depends-on-cask-multiple", "--skip-cask-deps")
|
||||||
end
|
end
|
||||||
Hbc.load("with-depends-on-cask-multiple").must_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-multiple.rb").must_be :installed?
|
||||||
Hbc.load("local-caffeine").wont_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb").wont_be :installed?
|
||||||
Hbc.load("local-transmission").wont_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").wont_be :installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
it "properly handles Casks that are not present" do
|
it "properly handles Casks that are not present" do
|
||||||
|
@ -64,8 +64,8 @@ describe Hbc::CLI::List do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "given a set of installed Casks" do
|
describe "given a set of installed Casks" do
|
||||||
let(:caffeine) { Hbc.load("local-caffeine") }
|
let(:caffeine) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") }
|
||||||
let(:transmission) { Hbc.load("local-transmission") }
|
let(:transmission) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb") }
|
||||||
let(:casks) { [caffeine, transmission] }
|
let(:casks) { [caffeine, transmission] }
|
||||||
|
|
||||||
it "lists the installed files for those Casks" do
|
it "lists the installed files for those Casks" do
|
||||||
|
@ -5,20 +5,20 @@ describe Hbc::CLI::Reinstall do
|
|||||||
shutup do
|
shutup do
|
||||||
Hbc::CLI::Install.run("local-transmission")
|
Hbc::CLI::Install.run("local-transmission")
|
||||||
end
|
end
|
||||||
Hbc.load("local-transmission").must_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::CLI::Reinstall.run("local-transmission")
|
Hbc::CLI::Reinstall.run("local-transmission")
|
||||||
end
|
end
|
||||||
Hbc.load("local-transmission").must_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows reinstalling a non installed Cask" do
|
it "allows reinstalling a non installed Cask" do
|
||||||
Hbc.load("local-transmission").wont_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").wont_be :installed?
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::CLI::Reinstall.run("local-transmission")
|
Hbc::CLI::Reinstall.run("local-transmission")
|
||||||
end
|
end
|
||||||
Hbc.load("local-transmission").must_be :installed?
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb").must_be :installed?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -20,8 +20,8 @@ describe Hbc::CLI::Uninstall do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "can uninstall and unlink multiple Casks at once" do
|
it "can uninstall and unlink multiple Casks at once" do
|
||||||
caffeine = Hbc.load("local-caffeine")
|
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||||
transmission = Hbc.load("local-transmission")
|
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(caffeine).install
|
Hbc::Installer.new(caffeine).install
|
||||||
|
@ -8,8 +8,8 @@ describe Hbc::CLI::Zap do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "can zap and unlink multiple Casks at once" do
|
it "can zap and unlink multiple Casks at once" do
|
||||||
caffeine = Hbc.load("local-caffeine")
|
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||||
transmission = Hbc.load("local-transmission")
|
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(caffeine).install
|
Hbc::Installer.new(caffeine).install
|
||||||
|
@ -3,7 +3,7 @@ require "test_helper"
|
|||||||
describe Hbc::Container::Dmg do
|
describe Hbc::Container::Dmg do
|
||||||
describe "mount!" do
|
describe "mount!" do
|
||||||
it "does not store nil mounts for dmgs with extra data" do
|
it "does not store nil mounts for dmgs with extra data" do
|
||||||
transmission = Hbc.load("local-transmission")
|
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||||
|
|
||||||
dmg = Hbc::Container::Dmg.new(
|
dmg = Hbc::Container::Dmg.new(
|
||||||
transmission,
|
transmission,
|
||||||
|
@ -13,7 +13,7 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
|
|
||||||
describe "depends_on cask" do
|
describe "depends_on cask" do
|
||||||
it "raises an exception when depends_on cask is cyclic" do
|
it "raises an exception when depends_on cask is cyclic" do
|
||||||
dep_cask = Hbc.load("with-depends-on-cask-cyclic")
|
dep_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-cyclic.rb")
|
||||||
lambda {
|
lambda {
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(dep_cask).install
|
Hbc::Installer.new(dep_cask).install
|
||||||
@ -22,7 +22,7 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "installs the dependency of a Cask and the Cask itself" do
|
it "installs the dependency of a Cask and the Cask itself" do
|
||||||
csk = Hbc.load("with-depends-on-cask")
|
csk = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask.rb")
|
||||||
dependency = Hbc.load(csk.depends_on.cask.first)
|
dependency = Hbc.load(csk.depends_on.cask.first)
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(csk).install
|
Hbc::Installer.new(csk).install
|
||||||
@ -35,35 +35,35 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
|
|
||||||
describe "depends_on macos" do
|
describe "depends_on macos" do
|
||||||
it "understands depends_on macos: <array>" do
|
it "understands depends_on macos: <array>" do
|
||||||
macos_cask = Hbc.load("with-depends-on-macos-array")
|
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-array.rb")
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(macos_cask).install
|
Hbc::Installer.new(macos_cask).install
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "understands depends_on macos: <comparison>" do
|
it "understands depends_on macos: <comparison>" do
|
||||||
macos_cask = Hbc.load("with-depends-on-macos-comparison")
|
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-comparison.rb")
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(macos_cask).install
|
Hbc::Installer.new(macos_cask).install
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "understands depends_on macos: <string>" do
|
it "understands depends_on macos: <string>" do
|
||||||
macos_cask = Hbc.load("with-depends-on-macos-string")
|
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-string.rb")
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(macos_cask).install
|
Hbc::Installer.new(macos_cask).install
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "understands depends_on macos: <symbol>" do
|
it "understands depends_on macos: <symbol>" do
|
||||||
macos_cask = Hbc.load("with-depends-on-macos-symbol")
|
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-symbol.rb")
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(macos_cask).install
|
Hbc::Installer.new(macos_cask).install
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an exception when depends_on macos is not satisfied" do
|
it "raises an exception when depends_on macos is not satisfied" do
|
||||||
macos_cask = Hbc.load("with-depends-on-macos-failure")
|
macos_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-failure.rb")
|
||||||
lambda {
|
lambda {
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(macos_cask).install
|
Hbc::Installer.new(macos_cask).install
|
||||||
@ -74,7 +74,7 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
|
|
||||||
describe "depends_on arch" do
|
describe "depends_on arch" do
|
||||||
it "succeeds when depends_on arch is satisfied" do
|
it "succeeds when depends_on arch is satisfied" do
|
||||||
arch_cask = Hbc.load("with-depends-on-arch")
|
arch_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-arch.rb")
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(arch_cask).install
|
Hbc::Installer.new(arch_cask).install
|
||||||
end
|
end
|
||||||
@ -83,7 +83,7 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
|
|
||||||
describe "depends_on x11" do
|
describe "depends_on x11" do
|
||||||
it "succeeds when depends_on x11 is satisfied" do
|
it "succeeds when depends_on x11 is satisfied" do
|
||||||
x11_cask = Hbc.load("with-depends-on-x11")
|
x11_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11.rb")
|
||||||
MacOS::X11.stubs(:installed?).returns(true)
|
MacOS::X11.stubs(:installed?).returns(true)
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(x11_cask).install
|
Hbc::Installer.new(x11_cask).install
|
||||||
@ -91,7 +91,7 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "raises an exception when depends_on x11 is not satisfied" do
|
it "raises an exception when depends_on x11 is not satisfied" do
|
||||||
x11_cask = Hbc.load("with-depends-on-x11")
|
x11_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11.rb")
|
||||||
MacOS::X11.stubs(:installed?).returns(false)
|
MacOS::X11.stubs(:installed?).returns(false)
|
||||||
lambda {
|
lambda {
|
||||||
shutup do
|
shutup do
|
||||||
@ -101,7 +101,7 @@ describe "Satisfy Dependencies and Requirements" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "never raises when depends_on x11: false" do
|
it "never raises when depends_on x11: false" do
|
||||||
x11_cask = Hbc.load("with-depends-on-x11-false")
|
x11_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11-false.rb")
|
||||||
MacOS::X11.stubs(:installed?).returns(false)
|
MacOS::X11.stubs(:installed?).returns(false)
|
||||||
lambda do
|
lambda do
|
||||||
shutup do
|
shutup do
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::DSL::Caveats do
|
describe Hbc::DSL::Caveats do
|
||||||
let(:cask) { Hbc.load("basic-cask") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||||
let(:dsl) { Hbc::DSL::Caveats.new(cask) }
|
let(:dsl) { Hbc::DSL::Caveats.new(cask) }
|
||||||
|
|
||||||
it_behaves_like Hbc::DSL::Base
|
it_behaves_like Hbc::DSL::Base
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::DSL::Postflight do
|
describe Hbc::DSL::Postflight do
|
||||||
let(:cask) { Hbc.load("basic-cask") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||||
let(:dsl) { Hbc::DSL::Postflight.new(cask, Hbc::FakeSystemCommand) }
|
let(:dsl) { Hbc::DSL::Postflight.new(cask, Hbc::FakeSystemCommand) }
|
||||||
|
|
||||||
it_behaves_like Hbc::DSL::Base
|
it_behaves_like Hbc::DSL::Base
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::DSL::Preflight do
|
describe Hbc::DSL::Preflight do
|
||||||
let(:cask) { Hbc.load("basic-cask") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||||
let(:dsl) { Hbc::DSL::Preflight.new(cask, Hbc::FakeSystemCommand) }
|
let(:dsl) { Hbc::DSL::Preflight.new(cask, Hbc::FakeSystemCommand) }
|
||||||
|
|
||||||
it_behaves_like Hbc::DSL::Base
|
it_behaves_like Hbc::DSL::Base
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::DSL::UninstallPostflight do
|
describe Hbc::DSL::UninstallPostflight do
|
||||||
let(:cask) { Hbc.load("basic-cask") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||||
let(:dsl) { Hbc::DSL::UninstallPostflight.new(cask, Hbc::FakeSystemCommand) }
|
let(:dsl) { Hbc::DSL::UninstallPostflight.new(cask, Hbc::FakeSystemCommand) }
|
||||||
|
|
||||||
it_behaves_like Hbc::DSL::Base
|
it_behaves_like Hbc::DSL::Base
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "test_helper"
|
require "test_helper"
|
||||||
|
|
||||||
describe Hbc::DSL::UninstallPreflight do
|
describe Hbc::DSL::UninstallPreflight do
|
||||||
let(:cask) { Hbc.load("basic-cask") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||||
let(:dsl) { Hbc::DSL::UninstallPreflight.new(cask, Hbc::FakeSystemCommand) }
|
let(:dsl) { Hbc::DSL::UninstallPreflight.new(cask, Hbc::FakeSystemCommand) }
|
||||||
|
|
||||||
it_behaves_like Hbc::DSL::Base
|
it_behaves_like Hbc::DSL::Base
|
||||||
|
@ -2,7 +2,7 @@ require "test_helper"
|
|||||||
|
|
||||||
describe Hbc::DSL do
|
describe Hbc::DSL do
|
||||||
it "lets you set url, homepage, and version" do
|
it "lets you set url, homepage, and version" do
|
||||||
test_cask = Hbc.load("basic-cask")
|
test_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb")
|
||||||
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
|
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
|
||||||
test_cask.homepage.must_equal "http://example.com/"
|
test_cask.homepage.must_equal "http://example.com/"
|
||||||
test_cask.version.to_s.must_equal "1.2.3"
|
test_cask.version.to_s.must_equal "1.2.3"
|
||||||
@ -48,20 +48,20 @@ describe Hbc::DSL do
|
|||||||
describe "header line" do
|
describe "header line" do
|
||||||
it "requires a valid header format" do
|
it "requires a valid header format" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-header-format")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-header-format.rb")
|
||||||
}.must_raise(SyntaxError)
|
}.must_raise(SyntaxError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "requires the header token to match the file name" do
|
it "requires the header token to match the file name" do
|
||||||
err = lambda {
|
err = lambda {
|
||||||
Hbc.load("invalid/invalid-header-token-mismatch")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-header-token-mismatch.rb")
|
||||||
}.must_raise(Hbc::CaskTokenDoesNotMatchError)
|
}.must_raise(Hbc::CaskTokenDoesNotMatchError)
|
||||||
err.message.must_include "Bad header line:"
|
err.message.must_include "Bad header line:"
|
||||||
err.message.must_include "does not match file name"
|
err.message.must_include "does not match file name"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not require a DSL version in the header" do
|
it "does not require a DSL version in the header" do
|
||||||
test_cask = Hbc.load("no-dsl-version")
|
test_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-dsl-version.rb")
|
||||||
test_cask.token.must_equal "no-dsl-version"
|
test_cask.token.must_equal "no-dsl-version"
|
||||||
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
|
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
|
||||||
test_cask.homepage.must_equal "http://example.com/"
|
test_cask.homepage.must_equal "http://example.com/"
|
||||||
@ -75,7 +75,7 @@ describe Hbc::DSL do
|
|||||||
|
|
||||||
ENV.stub :[], stub do
|
ENV.stub :[], stub do
|
||||||
shutup do
|
shutup do
|
||||||
test_cask = Hbc.load("with-dsl-version")
|
test_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-dsl-version.rb")
|
||||||
test_cask.token.must_equal "with-dsl-version"
|
test_cask.token.must_equal "with-dsl-version"
|
||||||
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
|
test_cask.url.to_s.must_equal "http://example.com/TestCask.dmg"
|
||||||
test_cask.homepage.must_equal "http://example.com/"
|
test_cask.homepage.must_equal "http://example.com/"
|
||||||
@ -233,7 +233,7 @@ describe Hbc::DSL do
|
|||||||
describe "url stanza" do
|
describe "url stanza" do
|
||||||
it "prevents defining multiple urls" do
|
it "prevents defining multiple urls" do
|
||||||
err = lambda {
|
err = lambda {
|
||||||
Hbc.load("invalid/invalid-two-url")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-two-url.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
err.message.must_include "'url' stanza may only appear once"
|
err.message.must_include "'url' stanza may only appear once"
|
||||||
end
|
end
|
||||||
@ -242,7 +242,7 @@ describe Hbc::DSL do
|
|||||||
describe "homepage stanza" do
|
describe "homepage stanza" do
|
||||||
it "prevents defining multiple homepages" do
|
it "prevents defining multiple homepages" do
|
||||||
err = lambda {
|
err = lambda {
|
||||||
Hbc.load("invalid/invalid-two-homepage")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-two-homepage.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
err.message.must_include "'homepage' stanza may only appear once"
|
err.message.must_include "'homepage' stanza may only appear once"
|
||||||
end
|
end
|
||||||
@ -251,7 +251,7 @@ describe Hbc::DSL do
|
|||||||
describe "version stanza" do
|
describe "version stanza" do
|
||||||
it "prevents defining multiple versions" do
|
it "prevents defining multiple versions" do
|
||||||
err = lambda {
|
err = lambda {
|
||||||
Hbc.load("invalid/invalid-two-version")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-two-version.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
err.message.must_include "'version' stanza may only appear once"
|
err.message.must_include "'version' stanza may only appear once"
|
||||||
end
|
end
|
||||||
@ -259,77 +259,77 @@ describe Hbc::DSL do
|
|||||||
|
|
||||||
describe "appcast stanza" do
|
describe "appcast stanza" do
|
||||||
it "allows appcasts to be specified" do
|
it "allows appcasts to be specified" do
|
||||||
cask = Hbc.load("with-appcast")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-appcast.rb")
|
||||||
cask.appcast.to_s.must_match(/^http/)
|
cask.appcast.to_s.must_match(/^http/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "prevents defining multiple appcasts" do
|
it "prevents defining multiple appcasts" do
|
||||||
err = lambda {
|
err = lambda {
|
||||||
Hbc.load("invalid/invalid-appcast-multiple")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-appcast-multiple.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
err.message.must_include "'appcast' stanza may only appear once"
|
err.message.must_include "'appcast' stanza may only appear once"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "refuses to load invalid appcast URLs" do
|
it "refuses to load invalid appcast URLs" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-appcast-url")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-appcast-url.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "gpg stanza" do
|
describe "gpg stanza" do
|
||||||
it "allows gpg stanza to be specified" do
|
it "allows gpg stanza to be specified" do
|
||||||
cask = Hbc.load("with-gpg")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-gpg.rb")
|
||||||
cask.gpg.to_s.must_match(/\S/)
|
cask.gpg.to_s.must_match(/\S/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows gpg stanza to be specified with :key_url" do
|
it "allows gpg stanza to be specified with :key_url" do
|
||||||
cask = Hbc.load("with-gpg-key-url")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-gpg-key-url.rb")
|
||||||
cask.gpg.to_s.must_match(/\S/)
|
cask.gpg.to_s.must_match(/\S/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "prevents specifying gpg stanza multiple times" do
|
it "prevents specifying gpg stanza multiple times" do
|
||||||
err = lambda {
|
err = lambda {
|
||||||
Hbc.load("invalid/invalid-gpg-multiple-stanzas")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-multiple-stanzas.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
err.message.must_include "'gpg' stanza may only appear once"
|
err.message.must_include "'gpg' stanza may only appear once"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "prevents missing gpg key parameters" do
|
it "prevents missing gpg key parameters" do
|
||||||
err = lambda {
|
err = lambda {
|
||||||
Hbc.load("invalid/invalid-gpg-missing-key")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-missing-key.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
err.message.must_include "'gpg' stanza must include exactly one"
|
err.message.must_include "'gpg' stanza must include exactly one"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "prevents conflicting gpg key parameters" do
|
it "prevents conflicting gpg key parameters" do
|
||||||
err = lambda {
|
err = lambda {
|
||||||
Hbc.load("invalid/invalid-gpg-conflicting-keys")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-conflicting-keys.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
err.message.must_include "'gpg' stanza must include exactly one"
|
err.message.must_include "'gpg' stanza must include exactly one"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "refuses to load invalid gpg signature URLs" do
|
it "refuses to load invalid gpg signature URLs" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-gpg-signature-url")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-signature-url.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "refuses to load invalid gpg key URLs" do
|
it "refuses to load invalid gpg key URLs" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-gpg-key-url")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-key-url.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "refuses to load invalid gpg key IDs" do
|
it "refuses to load invalid gpg key IDs" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-gpg-key-id")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-key-id.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "refuses to load if gpg parameter is unknown" do
|
it "refuses to load if gpg parameter is unknown" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-gpg-parameter")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-gpg-parameter.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -337,112 +337,112 @@ describe Hbc::DSL do
|
|||||||
describe "depends_on stanza" do
|
describe "depends_on stanza" do
|
||||||
it "refuses to load with an invalid depends_on key" do
|
it "refuses to load with an invalid depends_on key" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-depends-on-key")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-key.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "depends_on formula" do
|
describe "depends_on formula" do
|
||||||
it "allows depends_on formula to be specified" do
|
it "allows depends_on formula to be specified" do
|
||||||
cask = Hbc.load("with-depends-on-formula")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-formula.rb")
|
||||||
cask.depends_on.formula.wont_be_nil
|
cask.depends_on.formula.wont_be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows multiple depends_on formula to be specified" do
|
it "allows multiple depends_on formula to be specified" do
|
||||||
cask = Hbc.load("with-depends-on-formula-multiple")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-formula-multiple.rb")
|
||||||
cask.depends_on.formula.wont_be_nil
|
cask.depends_on.formula.wont_be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "depends_on cask" do
|
describe "depends_on cask" do
|
||||||
it "allows depends_on cask to be specified" do
|
it "allows depends_on cask to be specified" do
|
||||||
cask = Hbc.load("with-depends-on-cask")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask.rb")
|
||||||
cask.depends_on.cask.wont_be_nil
|
cask.depends_on.cask.wont_be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows multiple depends_on cask to be specified" do
|
it "allows multiple depends_on cask to be specified" do
|
||||||
cask = Hbc.load("with-depends-on-cask-multiple")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-cask-multiple.rb")
|
||||||
cask.depends_on.cask.wont_be_nil
|
cask.depends_on.cask.wont_be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "depends_on macos" do
|
describe "depends_on macos" do
|
||||||
it "allows depends_on macos to be specified" do
|
it "allows depends_on macos to be specified" do
|
||||||
cask = Hbc.load("with-depends-on-macos-string")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-macos-string.rb")
|
||||||
cask.depends_on.macos.wont_be_nil
|
cask.depends_on.macos.wont_be_nil
|
||||||
end
|
end
|
||||||
it "refuses to load with an invalid depends_on macos value" do
|
it "refuses to load with an invalid depends_on macos value" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-depends-on-macos-bad-release")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-macos-bad-release.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
it "refuses to load with conflicting depends_on macos forms" do
|
it "refuses to load with conflicting depends_on macos forms" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-depends-on-macos-conflicting-forms")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "depends_on arch" do
|
describe "depends_on arch" do
|
||||||
it "allows depends_on arch to be specified" do
|
it "allows depends_on arch to be specified" do
|
||||||
cask = Hbc.load("with-depends-on-arch")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-arch.rb")
|
||||||
cask.depends_on.arch.wont_be_nil
|
cask.depends_on.arch.wont_be_nil
|
||||||
end
|
end
|
||||||
it "refuses to load with an invalid depends_on arch value" do
|
it "refuses to load with an invalid depends_on arch value" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-depends-on-arch-value")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-arch-value.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "depends_on x11" do
|
describe "depends_on x11" do
|
||||||
it "allows depends_on x11 to be specified" do
|
it "allows depends_on x11 to be specified" do
|
||||||
cask = Hbc.load("with-depends-on-x11")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-depends-on-x11.rb")
|
||||||
cask.depends_on.x11.wont_be_nil
|
cask.depends_on.x11.wont_be_nil
|
||||||
end
|
end
|
||||||
it "refuses to load with an invalid depends_on x11 value" do
|
it "refuses to load with an invalid depends_on x11 value" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-depends-on-x11-value")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-depends-on-x11-value.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "conflicts_with stanza" do
|
describe "conflicts_with stanza" do
|
||||||
it "allows conflicts_with stanza to be specified" do
|
it "allows conflicts_with stanza to be specified" do
|
||||||
cask = Hbc.load("with-conflicts-with")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-conflicts-with.rb")
|
||||||
cask.conflicts_with.formula.wont_be_nil
|
cask.conflicts_with.formula.wont_be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it "refuses to load invalid conflicts_with key" do
|
it "refuses to load invalid conflicts_with key" do
|
||||||
lambda {
|
lambda {
|
||||||
Hbc.load("invalid/invalid-conflicts-with-key")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-conflicts-with-key.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "installer stanza" do
|
describe "installer stanza" do
|
||||||
it "allows installer script to be specified" do
|
it "allows installer script to be specified" do
|
||||||
cask = Hbc.load("with-installer-script")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-script.rb")
|
||||||
cask.artifacts[:installer].first.script[:executable].must_equal "/usr/bin/true"
|
cask.artifacts[:installer].first.script[:executable].must_equal "/usr/bin/true"
|
||||||
cask.artifacts[:installer].first.script[:args].must_equal ["--flag"]
|
cask.artifacts[:installer].first.script[:args].must_equal ["--flag"]
|
||||||
cask.artifacts[:installer].to_a[1].script[:executable].must_equal "/usr/bin/false"
|
cask.artifacts[:installer].to_a[1].script[:executable].must_equal "/usr/bin/false"
|
||||||
cask.artifacts[:installer].to_a[1].script[:args].must_equal ["--flag"]
|
cask.artifacts[:installer].to_a[1].script[:args].must_equal ["--flag"]
|
||||||
end
|
end
|
||||||
it "allows installer manual to be specified" do
|
it "allows installer manual to be specified" do
|
||||||
cask = Hbc.load("with-installer-manual")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-manual.rb")
|
||||||
cask.artifacts[:installer].first.manual.must_equal "Caffeine.app"
|
cask.artifacts[:installer].first.manual.must_equal "Caffeine.app"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "stage_only stanza" do
|
describe "stage_only stanza" do
|
||||||
it "allows stage_only stanza to be specified" do
|
it "allows stage_only stanza to be specified" do
|
||||||
cask = Hbc.load("stage-only")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/stage-only.rb")
|
||||||
cask.artifacts[:stage_only].first.must_equal [true]
|
cask.artifacts[:stage_only].first.must_equal [true]
|
||||||
end
|
end
|
||||||
|
|
||||||
it "prevents specifying stage_only with other activatables" do
|
it "prevents specifying stage_only with other activatables" do
|
||||||
err = lambda {
|
err = lambda {
|
||||||
Hbc.load("invalid/invalid-stage-only-conflict")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/invalid/invalid-stage-only-conflict.rb")
|
||||||
}.must_raise(Hbc::CaskInvalidError)
|
}.must_raise(Hbc::CaskInvalidError)
|
||||||
err.message.must_include "'stage_only' must be the only activatable artifact"
|
err.message.must_include "'stage_only' must be the only activatable artifact"
|
||||||
end
|
end
|
||||||
@ -450,14 +450,14 @@ describe Hbc::DSL do
|
|||||||
|
|
||||||
describe "auto_updates stanza" do
|
describe "auto_updates stanza" do
|
||||||
it "allows auto_updates stanza to be specified" do
|
it "allows auto_updates stanza to be specified" do
|
||||||
cask = Hbc.load("auto-updates")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
|
||||||
cask.auto_updates.must_equal true
|
cask.auto_updates.must_equal true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "appdir" do
|
describe "appdir" do
|
||||||
it "allows interpolation of the appdir value in stanzas" do
|
it "allows interpolation of the appdir value in stanzas" do
|
||||||
cask = Hbc.load("appdir-interpolation")
|
cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/appdir-interpolation.rb")
|
||||||
cask.artifacts[:binary].first.must_equal ["#{Hbc.appdir}/some/path"]
|
cask.artifacts[:binary].first.must_equal ["#{Hbc.appdir}/some/path"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ describe Hbc::Installer do
|
|||||||
}
|
}
|
||||||
|
|
||||||
it "downloads and installs a nice fresh Cask" do
|
it "downloads and installs a nice fresh Cask" do
|
||||||
caffeine = Hbc.load("local-caffeine")
|
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(caffeine).install
|
Hbc::Installer.new(caffeine).install
|
||||||
@ -20,7 +20,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "works with dmg-based Casks" do
|
it "works with dmg-based Casks" do
|
||||||
asset = Hbc.load("container-dmg")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-dmg.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
@ -33,7 +33,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "works with tar-gz-based Casks" do
|
it "works with tar-gz-based Casks" do
|
||||||
asset = Hbc.load("container-tar-gz")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-tar-gz.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
@ -47,7 +47,7 @@ describe Hbc::Installer do
|
|||||||
|
|
||||||
it "works with cab-based Casks" do
|
it "works with cab-based Casks" do
|
||||||
skip("cabextract not installed") if which("cabextract").nil?
|
skip("cabextract not installed") if which("cabextract").nil?
|
||||||
asset = Hbc.load("container-cab")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-cab.rb")
|
||||||
|
|
||||||
asset.stub :depends_on, empty_depends_on_stub do
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
@ -63,7 +63,7 @@ describe Hbc::Installer do
|
|||||||
|
|
||||||
it "works with Adobe AIR-based Casks" do
|
it "works with Adobe AIR-based Casks" do
|
||||||
skip("Adobe AIR not installed") unless Hbc::Container::Air.installer_exist?
|
skip("Adobe AIR not installed") unless Hbc::Container::Air.installer_exist?
|
||||||
asset = Hbc.load("container-air")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-air.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
@ -77,7 +77,7 @@ describe Hbc::Installer do
|
|||||||
|
|
||||||
it "works with 7z-based Casks" do
|
it "works with 7z-based Casks" do
|
||||||
skip("unar not installed") if which("unar").nil?
|
skip("unar not installed") if which("unar").nil?
|
||||||
asset = Hbc.load("container-7z")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-7z.rb")
|
||||||
|
|
||||||
asset.stub :depends_on, empty_depends_on_stub do
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
@ -92,7 +92,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "works with xar-based Casks" do
|
it "works with xar-based Casks" do
|
||||||
asset = Hbc.load("container-xar")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xar.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
@ -106,7 +106,7 @@ describe Hbc::Installer do
|
|||||||
|
|
||||||
it "works with Stuffit-based Casks" do
|
it "works with Stuffit-based Casks" do
|
||||||
skip("unar not installed") if which("unar").nil?
|
skip("unar not installed") if which("unar").nil?
|
||||||
asset = Hbc.load("container-sit")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-sit.rb")
|
||||||
|
|
||||||
asset.stub :depends_on, empty_depends_on_stub do
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
@ -122,7 +122,7 @@ describe Hbc::Installer do
|
|||||||
|
|
||||||
it "works with RAR-based Casks" do
|
it "works with RAR-based Casks" do
|
||||||
skip("unar not installed") if which("unar").nil?
|
skip("unar not installed") if which("unar").nil?
|
||||||
asset = Hbc.load("container-rar")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-rar.rb")
|
||||||
|
|
||||||
asset.stub :depends_on, empty_depends_on_stub do
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
@ -137,7 +137,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "works with pure bzip2-based Casks" do
|
it "works with pure bzip2-based Casks" do
|
||||||
asset = Hbc.load("container-bzip2")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-bzip2.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
@ -150,7 +150,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "works with pure gzip-based Casks" do
|
it "works with pure gzip-based Casks" do
|
||||||
asset = Hbc.load("container-gzip")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-gzip.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(asset).install
|
Hbc::Installer.new(asset).install
|
||||||
@ -164,7 +164,7 @@ describe Hbc::Installer do
|
|||||||
|
|
||||||
it "works with pure xz-based Casks" do
|
it "works with pure xz-based Casks" do
|
||||||
skip("unxz not installed") if which("unxz").nil?
|
skip("unxz not installed") if which("unxz").nil?
|
||||||
asset = Hbc.load("container-xz")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-xz.rb")
|
||||||
|
|
||||||
asset.stub :depends_on, empty_depends_on_stub do
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
@ -180,7 +180,7 @@ describe Hbc::Installer do
|
|||||||
|
|
||||||
it "works with lzma-based Casks" do
|
it "works with lzma-based Casks" do
|
||||||
skip("unlzma not installed") if which("unlzma").nil?
|
skip("unlzma not installed") if which("unlzma").nil?
|
||||||
asset = Hbc.load("container-lzma")
|
asset = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-lzma.rb")
|
||||||
|
|
||||||
asset.stub :depends_on, empty_depends_on_stub do
|
asset.stub :depends_on, empty_depends_on_stub do
|
||||||
shutup do
|
shutup do
|
||||||
@ -195,7 +195,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "blows up on a bad checksum" do
|
it "blows up on a bad checksum" do
|
||||||
bad_checksum = Hbc.load("bad-checksum")
|
bad_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/bad-checksum.rb")
|
||||||
lambda {
|
lambda {
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(bad_checksum).install
|
Hbc::Installer.new(bad_checksum).install
|
||||||
@ -204,7 +204,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "blows up on a missing checksum" do
|
it "blows up on a missing checksum" do
|
||||||
missing_checksum = Hbc.load("missing-checksum")
|
missing_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/missing-checksum.rb")
|
||||||
lambda {
|
lambda {
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(missing_checksum).install
|
Hbc::Installer.new(missing_checksum).install
|
||||||
@ -213,7 +213,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "installs fine if sha256 :no_check is used" do
|
it "installs fine if sha256 :no_check is used" do
|
||||||
no_checksum = Hbc.load("no-checksum")
|
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(no_checksum).install
|
Hbc::Installer.new(no_checksum).install
|
||||||
@ -223,14 +223,14 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "fails to install if sha256 :no_check is used with --require-sha" do
|
it "fails to install if sha256 :no_check is used with --require-sha" do
|
||||||
no_checksum = Hbc.load("no-checksum")
|
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
|
||||||
lambda {
|
lambda {
|
||||||
Hbc::Installer.new(no_checksum, require_sha: true).install
|
Hbc::Installer.new(no_checksum, require_sha: true).install
|
||||||
}.must_raise(Hbc::CaskNoShasumError)
|
}.must_raise(Hbc::CaskNoShasumError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "installs fine if sha256 :no_check is used with --require-sha and --force" do
|
it "installs fine if sha256 :no_check is used with --require-sha and --force" do
|
||||||
no_checksum = Hbc.load("no-checksum")
|
no_checksum = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/no-checksum.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(no_checksum, require_sha: true, force: true).install
|
Hbc::Installer.new(no_checksum, require_sha: true, force: true).install
|
||||||
@ -240,7 +240,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "prints caveats if they're present" do
|
it "prints caveats if they're present" do
|
||||||
with_caveats = Hbc.load("with-caveats")
|
with_caveats = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-caveats.rb")
|
||||||
lambda {
|
lambda {
|
||||||
Hbc::Installer.new(with_caveats).install
|
Hbc::Installer.new(with_caveats).install
|
||||||
}.must_output(/Here are some things you might want to know/)
|
}.must_output(/Here are some things you might want to know/)
|
||||||
@ -248,7 +248,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "prints installer :manual instructions when present" do
|
it "prints installer :manual instructions when present" do
|
||||||
with_installer_manual = Hbc.load("with-installer-manual")
|
with_installer_manual = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installer-manual.rb")
|
||||||
lambda {
|
lambda {
|
||||||
Hbc::Installer.new(with_installer_manual).install
|
Hbc::Installer.new(with_installer_manual).install
|
||||||
}.must_output(/To complete the installation of Cask with-installer-manual, you must also\nrun the installer at\n\n '#{with_installer_manual.staged_path.join('Caffeine.app')}'/)
|
}.must_output(/To complete the installation of Cask with-installer-manual, you must also\nrun the installer at\n\n '#{with_installer_manual.staged_path.join('Caffeine.app')}'/)
|
||||||
@ -256,7 +256,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "does not extract __MACOSX directories from zips" do
|
it "does not extract __MACOSX directories from zips" do
|
||||||
with_macosx_dir = Hbc.load("with-macosx-dir")
|
with_macosx_dir = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-macosx-dir.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(with_macosx_dir).install
|
Hbc::Installer.new(with_macosx_dir).install
|
||||||
@ -266,7 +266,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "installer method raises an exception when already-installed Casks which auto-update are attempted" do
|
it "installer method raises an exception when already-installed Casks which auto-update are attempted" do
|
||||||
auto_updates = Hbc.load("auto-updates")
|
auto_updates = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
|
||||||
auto_updates.installed?.must_equal false
|
auto_updates.installed?.must_equal false
|
||||||
installer = Hbc::Installer.new(auto_updates)
|
installer = Hbc::Installer.new(auto_updates)
|
||||||
|
|
||||||
@ -280,7 +280,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "allows already-installed Casks which auto-update to be installed if force is provided" do
|
it "allows already-installed Casks which auto-update to be installed if force is provided" do
|
||||||
auto_updates = Hbc.load("auto-updates")
|
auto_updates = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/auto-updates.rb")
|
||||||
auto_updates.installed?.must_equal false
|
auto_updates.installed?.must_equal false
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
@ -294,7 +294,7 @@ describe Hbc::Installer do
|
|||||||
|
|
||||||
# unlike the CLI, the internal interface throws exception on double-install
|
# unlike the CLI, the internal interface throws exception on double-install
|
||||||
it "installer method raises an exception when already-installed Casks are attempted" do
|
it "installer method raises an exception when already-installed Casks are attempted" do
|
||||||
transmission = Hbc.load("local-transmission")
|
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||||
transmission.installed?.must_equal false
|
transmission.installed?.must_equal false
|
||||||
installer = Hbc::Installer.new(transmission)
|
installer = Hbc::Installer.new(transmission)
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "allows already-installed Casks to be installed if force is provided" do
|
it "allows already-installed Casks to be installed if force is provided" do
|
||||||
transmission = Hbc.load("local-transmission")
|
transmission = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||||
transmission.installed?.must_equal false
|
transmission.installed?.must_equal false
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
@ -321,7 +321,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "works naked-pkg-based Casks" do
|
it "works naked-pkg-based Casks" do
|
||||||
naked_pkg = Hbc.load("container-pkg")
|
naked_pkg = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/container-pkg.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(naked_pkg).install
|
Hbc::Installer.new(naked_pkg).install
|
||||||
@ -333,7 +333,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "works properly with an overridden container :type" do
|
it "works properly with an overridden container :type" do
|
||||||
naked_executable = Hbc.load("naked-executable")
|
naked_executable = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/naked-executable.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(naked_executable).install
|
Hbc::Installer.new(naked_executable).install
|
||||||
@ -345,7 +345,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "works fine with a nested container" do
|
it "works fine with a nested container" do
|
||||||
nested_app = Hbc.load("nested-app")
|
nested_app = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/nested-app.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(nested_app).install
|
Hbc::Installer.new(nested_app).install
|
||||||
@ -356,7 +356,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "generates and finds a timestamped metadata directory for an installed Cask" do
|
it "generates and finds a timestamped metadata directory for an installed Cask" do
|
||||||
caffeine = Hbc.load("local-caffeine")
|
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(caffeine).install
|
Hbc::Installer.new(caffeine).install
|
||||||
@ -368,7 +368,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "generates and finds a metadata subdirectory for an installed Cask" do
|
it "generates and finds a metadata subdirectory for an installed Cask" do
|
||||||
caffeine = Hbc.load("local-caffeine")
|
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
Hbc::Installer.new(caffeine).install
|
Hbc::Installer.new(caffeine).install
|
||||||
@ -383,7 +383,7 @@ describe Hbc::Installer do
|
|||||||
|
|
||||||
describe "uninstall" do
|
describe "uninstall" do
|
||||||
it "fully uninstalls a Cask" do
|
it "fully uninstalls a Cask" do
|
||||||
caffeine = Hbc.load("local-caffeine")
|
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||||
installer = Hbc::Installer.new(caffeine)
|
installer = Hbc::Installer.new(caffeine)
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
@ -397,7 +397,7 @@ describe Hbc::Installer do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "uninstalls all versions if force is set" do
|
it "uninstalls all versions if force is set" do
|
||||||
caffeine = Hbc.load("local-caffeine")
|
caffeine = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb")
|
||||||
mutated_version = caffeine.version + ".1"
|
mutated_version = caffeine.version + ".1"
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
|
@ -6,7 +6,7 @@ require "test_helper"
|
|||||||
describe "Operations on staged Casks" do
|
describe "Operations on staged Casks" do
|
||||||
describe "bundle ID" do
|
describe "bundle ID" do
|
||||||
it "fetches the bundle ID from a staged cask" do
|
it "fetches the bundle ID from a staged cask" do
|
||||||
transmission_cask = Hbc.load("local-transmission")
|
transmission_cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-transmission.rb")
|
||||||
tr_installer = Hbc::Installer.new(transmission_cask)
|
tr_installer = Hbc::Installer.new(transmission_cask)
|
||||||
|
|
||||||
shutup do
|
shutup do
|
||||||
|
@ -2,7 +2,7 @@ require "test_helper"
|
|||||||
|
|
||||||
describe Hbc::UrlChecker do
|
describe Hbc::UrlChecker do
|
||||||
describe "request processing" do
|
describe "request processing" do
|
||||||
let(:cask) { Hbc.load("basic-cask") }
|
let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/basic-cask.rb") }
|
||||||
let(:checker) { Hbc::UrlChecker.new(cask) }
|
let(:checker) { Hbc::UrlChecker.new(cask) }
|
||||||
let(:with_stubbed_fetcher) {
|
let(:with_stubbed_fetcher) {
|
||||||
lambda { |&block|
|
lambda { |&block|
|
||||||
|
@ -41,8 +41,8 @@ describe "Cask" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "uses exact match when loading by token" do
|
it "uses exact match when loading by token" do
|
||||||
Hbc.load("test-opera").token.must_equal("test-opera")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/test-opera.rb").token.must_equal("test-opera")
|
||||||
Hbc.load("test-opera-mail").token.must_equal("test-opera-mail")
|
Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/test-opera-mail.rb").token.must_equal("test-opera-mail")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises an error when attempting to load a Cask that doesn't exist" do
|
it "raises an error when attempting to load a Cask that doesn't exist" do
|
||||||
|
@ -46,7 +46,7 @@ Hbc.caskroom = Hbc.default_caskroom.tap(&:mkpath)
|
|||||||
Hbc.default_tap = Tap.fetch("caskroom", "test").tap do |tap|
|
Hbc.default_tap = Tap.fetch("caskroom", "test").tap do |tap|
|
||||||
# link test casks
|
# link test casks
|
||||||
FileUtils.mkdir_p tap.path.dirname
|
FileUtils.mkdir_p tap.path.dirname
|
||||||
FileUtils.ln_s Pathname.new(__FILE__).dirname.join("support"), tap.path
|
FileUtils.ln_s TEST_FIXTURE_DIR.join("cask"), tap.path
|
||||||
end
|
end
|
||||||
|
|
||||||
# pretend that the caskroom/cask Tap is installed
|
# pretend that the caskroom/cask Tap is installed
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user