diff options
| author | Markus Reiter | 2017-10-07 18:30:32 +0200 |
|---|---|---|
| committer | GitHub | 2017-10-07 18:30:32 +0200 |
| commit | 5cbf8bdaa7ff080948618d7f3f62f8be2f72ef97 (patch) | |
| tree | fd6b201daffdf3cc204a0f2d53dd61dfd53e7845 /Library/Homebrew/test/cask/artifact | |
| parent | 62315e93f8b1308fc39bdea3d9dfe36db6e5bede (diff) | |
| parent | 97333df4cb4bd006401193639400a8bc6df56e3a (diff) | |
| download | brew-5cbf8bdaa7ff080948618d7f3f62f8be2f72ef97.tar.bz2 | |
Merge pull request #3283 from reitermarkus/cask-loader
Add helper method for Cask fixture paths and refactor CaskLoader.
Diffstat (limited to 'Library/Homebrew/test/cask/artifact')
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 f7543c05d..847bf25fa 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) { lambda do diff --git a/Library/Homebrew/test/cask/artifact/app_spec.rb b/Library/Homebrew/test/cask/artifact/app_spec.rb index e61fefaa0..4ead8b7f9 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) { cask.artifacts.find { |a| a.is_a?(described_class) } } diff --git a/Library/Homebrew/test/cask/artifact/binary_spec.rb b/Library/Homebrew/test/cask/artifact/binary_spec.rb index bf11ba237..6a3f1da34 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 } @@ -17,7 +17,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 @@ -37,7 +37,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 } @@ -91,7 +91,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 1bf3bbbdb..ea567abee 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) { lambda do @@ -19,7 +19,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 d7bd6f59a..f9cd056f8 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 8ea5a1bb3..7f1b64d1a 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 = cask.artifacts.find { |a| a.is_a?(described_class) } diff --git a/Library/Homebrew/test/cask/artifact/suite_spec.rb b/Library/Homebrew/test/cask/artifact/suite_spec.rb index 01d25c4cc..80d3e917f 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) { lambda do 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 84072fd1a..7f2ef75b3 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) { lambda do @@ -31,7 +31,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 a91e93405..c6ff7d30e 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) { cask.artifacts.find { |a| a.is_a?(described_class) } 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 5e302d35a..b9872ab9e 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( |
