aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cask/artifact
diff options
context:
space:
mode:
authorMarkus Reiter2017-10-07 15:58:49 +0200
committerMarkus Reiter2017-10-07 16:11:25 +0200
commit97333df4cb4bd006401193639400a8bc6df56e3a (patch)
treed04a2c243da0486c4e3248e74f392c6716c8bf88 /Library/Homebrew/test/cask/artifact
parent113e5da55e630018cba9da19f4d3b268c2e7ee37 (diff)
downloadbrew-97333df4cb4bd006401193639400a8bc6df56e3a.tar.bz2
Add helper method for Cask fixture paths and refactor CaskLoader.
Diffstat (limited to 'Library/Homebrew/test/cask/artifact')
-rw-r--r--Library/Homebrew/test/cask/artifact/alt_target_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/artifact/app_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/artifact/binary_spec.rb8
-rw-r--r--Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb4
-rw-r--r--Library/Homebrew/test/cask/artifact/nested_container_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/artifact/pkg_spec.rb4
-rw-r--r--Library/Homebrew/test/cask/artifact/suite_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb4
-rw-r--r--Library/Homebrew/test/cask/artifact/two_apps_incorrect_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb2
-rw-r--r--Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb18
11 files changed, 25 insertions, 25 deletions
diff --git a/Library/Homebrew/test/cask/artifact/alt_target_spec.rb b/Library/Homebrew/test/cask/artifact/alt_target_spec.rb
index 02be796ed..346b90e78 100644
--- a/Library/Homebrew/test/cask/artifact/alt_target_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/alt_target_spec.rb
@@ -1,6 +1,6 @@
describe Hbc::Artifact::App, :cask do
describe "activate to alternate target" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-alt-target.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-alt-target")) }
let(:install_phase) {
-> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } }
diff --git a/Library/Homebrew/test/cask/artifact/app_spec.rb b/Library/Homebrew/test/cask/artifact/app_spec.rb
index f67ffd31b..b38a60317 100644
--- a/Library/Homebrew/test/cask/artifact/app_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/app_spec.rb
@@ -1,5 +1,5 @@
describe Hbc::Artifact::App, :cask do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("local-caffeine")) }
let(:command) { Hbc::SystemCommand }
let(:force) { false }
let(:app) { described_class.for_cask(cask).first }
diff --git a/Library/Homebrew/test/cask/artifact/binary_spec.rb b/Library/Homebrew/test/cask/artifact/binary_spec.rb
index 5ffaca861..bbd125864 100644
--- a/Library/Homebrew/test/cask/artifact/binary_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/binary_spec.rb
@@ -1,6 +1,6 @@
describe Hbc::Artifact::Binary, :cask do
let(:cask) {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-binary.rb").tap do |cask|
+ Hbc::CaskLoader.load(cask_path("with-binary")).tap do |cask|
InstallHelper.install_without_artifacts(cask)
end
}
@@ -16,7 +16,7 @@ describe Hbc::Artifact::Binary, :cask do
context "when --no-binaries is specified" do
let(:cask) {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-binary.rb")
+ Hbc::CaskLoader.load(cask_path("with-binary"))
}
it "doesn't link the binary when --no-binaries is specified" do
@@ -35,7 +35,7 @@ describe Hbc::Artifact::Binary, :cask do
context "when the binary is not executable" do
let(:cask) {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-non-executable-binary.rb").tap do |cask|
+ Hbc::CaskLoader.load(cask_path("with-non-executable-binary")).tap do |cask|
InstallHelper.install_without_artifacts(cask)
end
}
@@ -85,7 +85,7 @@ describe Hbc::Artifact::Binary, :cask do
context "binary is inside an app package" do
let(:cask) {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-embedded-binary.rb").tap do |cask|
+ Hbc::CaskLoader.load(cask_path("with-embedded-binary")).tap do |cask|
InstallHelper.install_without_artifacts(cask)
end
}
diff --git a/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb b/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb
index bec8c2742..bcd3155d3 100644
--- a/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb
@@ -1,5 +1,5 @@
describe Hbc::Artifact::Artifact, :cask do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-generic-artifact")) }
let(:install_phase) {
-> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } }
@@ -15,7 +15,7 @@ describe Hbc::Artifact::Artifact, :cask do
context "without target" do
it "fails to load" do
expect {
- Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact-no-target.rb")
+ Hbc::CaskLoader.load(cask_path("with-generic-artifact-no-target"))
}.to raise_error(Hbc::CaskInvalidError, /target required for Generic Artifact/)
end
end
diff --git a/Library/Homebrew/test/cask/artifact/nested_container_spec.rb b/Library/Homebrew/test/cask/artifact/nested_container_spec.rb
index 41d143764..ef23c3fd7 100644
--- a/Library/Homebrew/test/cask/artifact/nested_container_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/nested_container_spec.rb
@@ -1,7 +1,7 @@
describe Hbc::Artifact::NestedContainer, :cask do
describe "install" do
it "extracts the specified paths as containers" do
- cask = Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/nested-app.rb").tap do |c|
+ cask = Hbc::CaskLoader.load(cask_path("nested-app")).tap do |c|
InstallHelper.install_without_artifacts(c)
end
diff --git a/Library/Homebrew/test/cask/artifact/pkg_spec.rb b/Library/Homebrew/test/cask/artifact/pkg_spec.rb
index c6a45c49a..71eb7bf4f 100644
--- a/Library/Homebrew/test/cask/artifact/pkg_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/pkg_spec.rb
@@ -1,5 +1,5 @@
describe Hbc::Artifact::Pkg, :cask do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-installable")) }
let(:fake_system_command) { class_double(Hbc::SystemCommand) }
before(:each) do
@@ -22,7 +22,7 @@ describe Hbc::Artifact::Pkg, :cask do
end
describe "choices" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-choices.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-choices")) }
it "passes the choice changes xml to the system installer" do
pkg = described_class.for_cask(cask).first
diff --git a/Library/Homebrew/test/cask/artifact/suite_spec.rb b/Library/Homebrew/test/cask/artifact/suite_spec.rb
index 2f913fecc..5c322e0e2 100644
--- a/Library/Homebrew/test/cask/artifact/suite_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/suite_spec.rb
@@ -1,5 +1,5 @@
describe Hbc::Artifact::Suite, :cask do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-suite.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-suite")) }
let(:install_phase) {
-> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } }
diff --git a/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb b/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb
index f6e0d3c97..536296620 100644
--- a/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb
@@ -1,6 +1,6 @@
describe Hbc::Artifact::App, :cask do
describe "multiple apps" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-correct.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-two-apps-correct")) }
let(:install_phase) {
-> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } }
@@ -27,7 +27,7 @@ describe Hbc::Artifact::App, :cask do
end
describe "when apps are in a subdirectory" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-subdir.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-two-apps-subdir")) }
it "installs both apps using the proper target directory" do
install_phase.call
diff --git a/Library/Homebrew/test/cask/artifact/two_apps_incorrect_spec.rb b/Library/Homebrew/test/cask/artifact/two_apps_incorrect_spec.rb
index 6427ec32c..cda5b4488 100644
--- a/Library/Homebrew/test/cask/artifact/two_apps_incorrect_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/two_apps_incorrect_spec.rb
@@ -2,7 +2,7 @@ describe Hbc::Artifact::App, :cask do
# FIXME: Doesn't actually raise because the `app` stanza is not evaluated on load.
# it "must raise" do
# lambda {
- # Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-incorrect.rb")
+ # Hbc::CaskLoader.load(cask_path("with-two-apps-incorrect"))
# }.must_raise
# # TODO: later give the user a nice exception for this case and check for it here
# end
diff --git a/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb b/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb
index d6a8393da..f1940fc4d 100644
--- a/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb
+++ b/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb
@@ -1,5 +1,5 @@
describe Hbc::Artifact::Zap, :cask do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-installable")) }
let(:zap_artifact) {
described_class.for_cask(cask).first
diff --git a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
index 4fdab60d0..59f3d946f 100644
--- a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
+++ b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb
@@ -6,7 +6,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
subject { artifact.public_send(:"#{artifact_dsl_key}_phase", command: fake_system_command) }
context "using :launchctl" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-launchctl.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-launchctl")) }
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(:unknown_response) { "launchctl list returned unknown response\n" }
@@ -61,7 +61,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
context "using :pkgutil" do
let(:fake_system_command) { class_double(Hbc::SystemCommand) }
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-pkgutil.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-pkgutil")) }
let(:main_pkg_id) { "my.fancy.package.main" }
let(:agent_pkg_id) { "my.fancy.package.agent" }
@@ -85,7 +85,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
end
context "using :kext" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-kext.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-kext")) }
let(:kext_id) { "my.fancy.package.kernelextension" }
it "is supported" do
@@ -110,7 +110,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
end
context "using :quit" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-quit.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-quit")) }
let(:bundle_id) { "my.fancy.package.app" }
let(:quit_application_script) do
%Q(tell application id "#{bundle_id}" to quit)
@@ -130,7 +130,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
end
context "using :signal" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-signal.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-signal")) }
let(:bundle_id) { "my.fancy.package.app" }
let(:signals) { %w[TERM KILL] }
let(:unix_pids) { [12_345, 67_890] }
@@ -172,7 +172,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
end
let(:fake_system_command) { Hbc::NeverSudoSystemCommand }
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-#{directive}.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-#{directive}")) }
before(:each) do
allow_any_instance_of(Hbc::Artifact::AbstractUninstall).to receive(:trash_paths)
@@ -198,7 +198,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
context "using :rmdir" do
let(:fake_system_command) { Hbc::NeverSudoSystemCommand }
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-rmdir.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-rmdir")) }
let(:empty_directory) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") }
let(:ds_store) { empty_directory.join(".DS_Store") }
@@ -226,7 +226,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
context "using #{script_type.inspect}" do
let(:fake_system_command) { Hbc::NeverSudoSystemCommand }
let(:token) { "with-#{artifact_dsl_key}-#{script_type}".tr("_", "-") }
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/#{token}.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path(token.to_s)) }
let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") }
it "is supported" do
@@ -252,7 +252,7 @@ shared_examples "#uninstall_phase or #zap_phase" do
end
context "using :login_item" do
- let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-login-item.rb") }
+ let(:cask) { Hbc::CaskLoader.load(cask_path("with-#{artifact_dsl_key}-login-item")) }
it "is supported" do
Hbc::FakeSystemCommand.expects_command(