diff options
| author | Markus Reiter | 2017-04-06 00:33:31 +0200 |
|---|---|---|
| committer | Markus Reiter | 2017-09-10 23:12:32 +0200 |
| commit | 53ecdd843f6e6d6dd93e09a5394de3c31bc0e51a (patch) | |
| tree | 052898092af480f6fd184870c4cdb8203f67662e /Library/Homebrew/test | |
| parent | 5bcce735ddd7b68da6bde7dec6ca318c7801aade (diff) | |
| download | brew-53ecdd843f6e6d6dd93e09a5394de3c31bc0e51a.tar.bz2 | |
Treat every `Artifact` instance as a single artifact.
Diffstat (limited to 'Library/Homebrew/test')
16 files changed, 85 insertions, 74 deletions
diff --git a/Library/Homebrew/test/cask/artifact/alt_target_spec.rb b/Library/Homebrew/test/cask/artifact/alt_target_spec.rb index 9e8d83bb4..02be796ed 100644 --- a/Library/Homebrew/test/cask/artifact/alt_target_spec.rb +++ b/Library/Homebrew/test/cask/artifact/alt_target_spec.rb @@ -3,7 +3,7 @@ describe Hbc::Artifact::App, :cask do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-alt-target.rb") } let(:install_phase) { - -> { Hbc::Artifact::App.new(cask).install_phase } + -> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } } } let(:source_path) { cask.staged_path.join("Caffeine.app") } diff --git a/Library/Homebrew/test/cask/artifact/app_spec.rb b/Library/Homebrew/test/cask/artifact/app_spec.rb index 0add472e2..f67ffd31b 100644 --- a/Library/Homebrew/test/cask/artifact/app_spec.rb +++ b/Library/Homebrew/test/cask/artifact/app_spec.rb @@ -2,13 +2,13 @@ describe Hbc::Artifact::App, :cask do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/local-caffeine.rb") } let(:command) { Hbc::SystemCommand } let(:force) { false } - let(:app) { Hbc::Artifact::App.new(cask, command: command, force: force) } + let(:app) { described_class.for_cask(cask).first } let(:source_path) { cask.staged_path.join("Caffeine.app") } let(:target_path) { Hbc.appdir.join("Caffeine.app") } - let(:install_phase) { app.install_phase } - let(:uninstall_phase) { app.uninstall_phase } + let(:install_phase) { app.install_phase(command: command, force: force) } + let(:uninstall_phase) { app.uninstall_phase(command: command, force: force) } before(:each) do InstallHelper.install_without_artifacts(cask) @@ -105,8 +105,8 @@ describe Hbc::Artifact::App, :cask do describe "target is user-owned but contains read-only files" do before(:each) do - system "/usr/bin/touch", "--", "#{target_path}/foo" - system "/bin/chmod", "--", "0555", target_path + FileUtils.touch "#{target_path}/foo" + FileUtils.chmod 0555, target_path end it "overwrites the existing app" do @@ -138,7 +138,7 @@ describe Hbc::Artifact::App, :cask do end after(:each) do - system "/bin/chmod", "--", "0755", target_path + FileUtils.chmod 0755, target_path end end end @@ -206,8 +206,8 @@ describe Hbc::Artifact::App, :cask do end describe "summary" do - let(:description) { app.summary[:english_description] } - let(:contents) { app.summary[:contents] } + let(:description) { app.class.english_description } + let(:contents) { app.summarize_installed } it "returns the correct english_description" do expect(description).to eq("Apps") @@ -217,14 +217,13 @@ describe Hbc::Artifact::App, :cask do it "returns the path to the app" do install_phase - expect(contents).to eq(["#{target_path} (#{target_path.abv})"]) + expect(contents).to eq("#{target_path} (#{target_path.abv})") end end describe "app is missing" do it "returns a warning and the supposed path to the app" do - expect(contents.size).to eq(1) - expect(contents[0]).to match(/.*Missing App.*: #{target_path}/) + expect(contents).to match(/.*Missing App.*: #{target_path}/) end end end diff --git a/Library/Homebrew/test/cask/artifact/binary_spec.rb b/Library/Homebrew/test/cask/artifact/binary_spec.rb index ce00e3935..5ffaca861 100644 --- a/Library/Homebrew/test/cask/artifact/binary_spec.rb +++ b/Library/Homebrew/test/cask/artifact/binary_spec.rb @@ -26,7 +26,8 @@ describe Hbc::Artifact::Binary, :cask do end it "links the binary to the proper directory" do - Hbc::Artifact::Binary.new(cask).install_phase + described_class.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(expected_path).to be_a_symlink expect(expected_path.readlink).to exist @@ -45,7 +46,8 @@ describe Hbc::Artifact::Binary, :cask do expect(FileUtils).to receive(:chmod) .with("+x", cask.staged_path.join("naked_non_executable")).and_call_original - Hbc::Artifact::Binary.new(cask).install_phase + described_class.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(expected_path).to be_a_symlink expect(expected_path.readlink).to be_executable @@ -56,7 +58,8 @@ describe Hbc::Artifact::Binary, :cask do FileUtils.touch expected_path expect { - Hbc::Artifact::Binary.new(cask).install_phase + described_class.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } }.to raise_error(Hbc::CaskError) expect(expected_path).not_to be :symlink? @@ -65,7 +68,8 @@ describe Hbc::Artifact::Binary, :cask do it "clobbers an existing symlink" do expected_path.make_symlink("/tmp") - Hbc::Artifact::Binary.new(cask).install_phase + described_class.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(File.readlink(expected_path)).not_to eq("/tmp") end @@ -73,7 +77,8 @@ describe Hbc::Artifact::Binary, :cask do it "creates parent directory if it doesn't exist" do FileUtils.rmdir Hbc.binarydir - Hbc::Artifact::Binary.new(cask).install_phase + described_class.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(expected_path.exist?).to be true end @@ -86,8 +91,10 @@ describe Hbc::Artifact::Binary, :cask do } it "links the binary to the proper directory" do - Hbc::Artifact::App.new(cask).install_phase - Hbc::Artifact::Binary.new(cask).install_phase + Hbc::Artifact::App.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } + described_class.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(expected_path).to be_a_symlink expect(expected_path.readlink).to exist diff --git a/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb b/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb index cb2ef9850..bec8c2742 100644 --- a/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb +++ b/Library/Homebrew/test/cask/artifact/generic_artifact_spec.rb @@ -2,7 +2,7 @@ describe Hbc::Artifact::Artifact, :cask do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-generic-artifact.rb") } let(:install_phase) { - -> { Hbc::Artifact::Artifact.new(cask).install_phase } + -> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } } } let(:source_path) { cask.staged_path.join("Caffeine.app") } @@ -12,11 +12,11 @@ describe Hbc::Artifact::Artifact, :cask do InstallHelper.install_without_artifacts(cask) end - describe "with no target" do - 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 - expect(install_phase).to raise_error(Hbc::CaskInvalidError) + 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") + }.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 be7ba5ff8..41d143764 100644 --- a/Library/Homebrew/test/cask/artifact/nested_container_spec.rb +++ b/Library/Homebrew/test/cask/artifact/nested_container_spec.rb @@ -5,7 +5,8 @@ describe Hbc::Artifact::NestedContainer, :cask do InstallHelper.install_without_artifacts(c) end - Hbc::Artifact::NestedContainer.new(cask).install_phase + described_class.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(cask.staged_path.join("MyNestedApp.app")).to be_a_directory end diff --git a/Library/Homebrew/test/cask/artifact/pkg_spec.rb b/Library/Homebrew/test/cask/artifact/pkg_spec.rb index 3e62616ea..c6a45c49a 100644 --- a/Library/Homebrew/test/cask/artifact/pkg_spec.rb +++ b/Library/Homebrew/test/cask/artifact/pkg_spec.rb @@ -8,7 +8,7 @@ describe Hbc::Artifact::Pkg, :cask do describe "install_phase" do it "runs the system installer on the specified pkgs" do - pkg = Hbc::Artifact::Pkg.new(cask, command: fake_system_command) + pkg = described_class.for_cask(cask).first expect(fake_system_command).to receive(:run!).with( "/usr/sbin/installer", @@ -17,7 +17,7 @@ describe Hbc::Artifact::Pkg, :cask do print_stdout: true, ) - pkg.install_phase + pkg.install_phase(command: fake_system_command) end end @@ -25,7 +25,7 @@ describe Hbc::Artifact::Pkg, :cask do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-choices.rb") } it "passes the choice changes xml to the system installer" do - pkg = Hbc::Artifact::Pkg.new(cask, command: fake_system_command) + pkg = described_class.for_cask(cask).first file = double(path: Pathname.new("/tmp/choices.xml")) @@ -57,7 +57,7 @@ describe Hbc::Artifact::Pkg, :cask do print_stdout: true, ) - pkg.install_phase + pkg.install_phase(command: fake_system_command) end end end diff --git a/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb b/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb index 51b1431f0..4a44bb59b 100644 --- a/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb +++ b/Library/Homebrew/test/cask/artifact/postflight_block_spec.rb @@ -11,7 +11,8 @@ describe Hbc::Artifact::PostflightBlock, :cask do end end - described_class.new(cask).install_phase + described_class.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(called).to be true expect(yielded_arg).to be_kind_of(Hbc::DSL::Postflight) @@ -30,7 +31,8 @@ describe Hbc::Artifact::PostflightBlock, :cask do end end - described_class.new(cask).uninstall_phase + described_class.for_cask(cask) + .each { |artifact| artifact.uninstall_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(called).to be true expect(yielded_arg).to be_kind_of(Hbc::DSL::UninstallPostflight) diff --git a/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb b/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb index b13c4ab9d..d7d4e72d9 100644 --- a/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb +++ b/Library/Homebrew/test/cask/artifact/preflight_block_spec.rb @@ -11,7 +11,8 @@ describe Hbc::Artifact::PreflightBlock, :cask do end end - described_class.new(cask).install_phase + described_class.for_cask(cask) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(called).to be true expect(yielded_arg).to be_kind_of Hbc::DSL::Preflight @@ -30,7 +31,8 @@ describe Hbc::Artifact::PreflightBlock, :cask do end end - described_class.new(cask).uninstall_phase + described_class.for_cask(cask) + .each { |artifact| artifact.uninstall_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect(called).to be true expect(yielded_arg).to be_kind_of Hbc::DSL::UninstallPreflight diff --git a/Library/Homebrew/test/cask/artifact/suite_spec.rb b/Library/Homebrew/test/cask/artifact/suite_spec.rb index 8c217a9e0..2f913fecc 100644 --- a/Library/Homebrew/test/cask/artifact/suite_spec.rb +++ b/Library/Homebrew/test/cask/artifact/suite_spec.rb @@ -1,7 +1,9 @@ describe Hbc::Artifact::Suite, :cask do 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) { + -> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } } + } let(:target_path) { Hbc.appdir.join("Caffeine") } let(:source_path) { cask.staged_path.join("Caffeine") } 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 a1fdd3b74..f6e0d3c97 100644 --- a/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb +++ b/Library/Homebrew/test/cask/artifact/two_apps_correct_spec.rb @@ -3,7 +3,7 @@ describe Hbc::Artifact::App, :cask do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-two-apps-correct.rb") } let(:install_phase) { - -> { Hbc::Artifact::App.new(cask).install_phase } + -> { described_class.for_cask(cask).each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } } } let(:source_path_mini) { cask.staged_path.join("Caffeine Mini.app") } 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 8cd0b1e41..d6a8393da 100644 --- a/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb +++ b/Library/Homebrew/test/cask/artifact/uninstall_no_zap_spec.rb @@ -2,7 +2,7 @@ describe Hbc::Artifact::Zap, :cask do let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-installable.rb") } let(:zap_artifact) { - Hbc::Artifact::Zap.new(cask) + described_class.for_cask(cask).first } before(:each) do 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 0e522bc21..06eec4a01 100644 --- a/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb +++ b/Library/Homebrew/test/cask/artifact/uninstall_zap_shared_examples.rb @@ -1,12 +1,12 @@ shared_examples "#uninstall_phase or #zap_phase" do - let(:artifact_name) { described_class.artifact_name } - let(:artifact) { described_class.new(cask, command: fake_system_command) } + let(:artifact_dsl_key) { described_class.dsl_key } + let(:artifact) { described_class.for_cask(cask).first } let(:fake_system_command) { Hbc::FakeSystemCommand } - subject { artifact.public_send(:"#{artifact_name}_phase") } + 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_name}-launchctl.rb") } + let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-launchctl.rb") } 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_name}-pkgutil.rb") } + let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-pkgutil.rb") } 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_name}-kext.rb") } + let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-kext.rb") } 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_name}-quit.rb") } + let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-quit.rb") } 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_name}-signal.rb") } + let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-signal.rb") } let(:bundle_id) { "my.fancy.package.app" } let(:signals) { %w[TERM KILL] } let(:unix_pids) { [12_345, 67_890] } @@ -170,10 +170,10 @@ 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_name}-#{directive}.rb") } + let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-#{directive}.rb") } before(:each) do - allow_any_instance_of(Hbc::Artifact::UninstallBase).to receive(:trash_paths) + allow_any_instance_of(Hbc::Artifact::AbstractUninstall).to receive(:trash_paths) .and_wrap_original do |method, *args| result = method.call(*args) FileUtils.rm_rf result.stdout.split("\0") @@ -196,7 +196,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_name}-rmdir.rb") } + let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-rmdir.rb") } let(:empty_directory) { Pathname.new("#{TEST_TMPDIR}/empty_directory_path") } let(:ds_store) { empty_directory.join(".DS_Store") } @@ -223,7 +223,7 @@ shared_examples "#uninstall_phase or #zap_phase" do [:script, :early_script].each do |script_type| context "using #{script_type.inspect}" do let(:fake_system_command) { Hbc::NeverSudoSystemCommand } - let(:token) { "with-#{artifact_name}-#{script_type}".tr("_", "-") } + let(:token) { "with-#{artifact_dsl_key}-#{script_type}".tr("_", "-") } let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/#{token}.rb") } let(:script_pathname) { cask.staged_path.join("MyFancyPkg", "FancyUninstaller.tool") } @@ -250,7 +250,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_name}-login-item.rb") } + let(:cask) { Hbc::CaskLoader.load_from_file(TEST_FIXTURE_DIR/"cask/Casks/with-#{artifact_dsl_key}-login-item.rb") } it "is supported" do Hbc::FakeSystemCommand.expects_command( diff --git a/Library/Homebrew/test/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb index ddc773e3e..7e140acb2 100644 --- a/Library/Homebrew/test/cask/audit_spec.rb +++ b/Library/Homebrew/test/cask/audit_spec.rb @@ -265,19 +265,14 @@ describe Hbc::Audit, :cask do end describe "generic artifact checks" do - context "with no target" do - let(:cask_token) { "generic-artifact-no-target" } - it { is_expected.to fail_with(/target required for generic artifact/) } - end - context "with relative target" do let(:cask_token) { "generic-artifact-relative-target" } - it { is_expected.to fail_with(/target must be absolute path for generic artifact/) } + it { is_expected.to fail_with(/target must be absolute path for Generic Artifact/) } end context "with absolute target" do let(:cask_token) { "generic-artifact-absolute-target" } - it { should_not fail_with(/target required for generic artifact/) } + it { should_not fail_with(/target required for Generic Artifact/) } end end diff --git a/Library/Homebrew/test/cask/cli/info_spec.rb b/Library/Homebrew/test/cask/cli/info_spec.rb index bffe900ec..aec7080de 100644 --- a/Library/Homebrew/test/cask/cli/info_spec.rb +++ b/Library/Homebrew/test/cask/cli/info_spec.rb @@ -10,7 +10,7 @@ describe Hbc::CLI::Info, :cask do ==> Name None ==> Artifacts - Caffeine.app (app) + Caffeine.app (App) EOS end @@ -24,7 +24,7 @@ describe Hbc::CLI::Info, :cask do ==> Name None ==> Artifacts - Caffeine.app (app) + Caffeine.app (App) local-transmission: 2.61 http://example.com/local-transmission Not installed @@ -32,7 +32,7 @@ describe Hbc::CLI::Info, :cask do ==> Name None ==> Artifacts - Transmission.app (app) + Transmission.app (App) EOS } @@ -60,7 +60,7 @@ describe Hbc::CLI::Info, :cask do ==> Name None ==> Artifacts - Caffeine.app (app) + Caffeine.app (App) ==> Caveats Here are some things you might want to know. @@ -86,7 +86,7 @@ describe Hbc::CLI::Info, :cask do ==> Name None ==> Artifacts - Caffeine.app (app) + Caffeine.app (App) EOS end diff --git a/Library/Homebrew/test/cask/cli/list_spec.rb b/Library/Homebrew/test/cask/cli/list_spec.rb index ecca3035f..fd6997f41 100644 --- a/Library/Homebrew/test/cask/cli/list_spec.rb +++ b/Library/Homebrew/test/cask/cli/list_spec.rb @@ -48,7 +48,8 @@ describe Hbc::CLI::List, :cask do it "lists the installed files for those Casks" do casks.each(&InstallHelper.method(:install_without_artifacts_with_caskfile)) - Hbc::Artifact::App.new(transmission).install_phase + Hbc::Artifact::App.for_cask(transmission) + .each { |artifact| artifact.install_phase(command: Hbc::NeverSudoSystemCommand, force: false) } expect { Hbc::CLI::List.run("local-transmission", "local-caffeine") diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 7f2207a87..aec1e917f 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -186,12 +186,12 @@ describe Hbc::DSL, :cask do app "Bar.app" end - expect(Array(cask.artifacts[:app])).to eq([["Foo.app"], ["Bar.app"]]) + expect(cask.artifacts[:app].map(&:to_s)).to eq(["Foo.app (App)", "Bar.app (App)"]) end it "allow app stanzas to be empty" do cask = Hbc::Cask.new("cask-with-no-apps") - expect(Array(cask.artifacts[:app])).to eq([]) + expect(cask.artifacts[:app]).to be_empty end end @@ -219,7 +219,7 @@ describe Hbc::DSL, :cask do pkg "Bar.pkg" end - expect(Array(cask.artifacts[:pkg])).to eq([["Foo.pkg"], ["Bar.pkg"]]) + expect(cask.artifacts[:pkg].map(&:to_s)).to eq(["Foo.pkg (Pkg)", "Bar.pkg (Pkg)"]) end end @@ -471,10 +471,10 @@ describe Hbc::DSL, :cask do let(:token) { "with-installer-script" } it "allows installer script to be specified" do - expect(cask.artifacts[:installer].first.script[:executable]).to eq("/usr/bin/true") - expect(cask.artifacts[:installer].first.script[:args]).to eq(["--flag"]) - expect(cask.artifacts[:installer].to_a[1].script[:executable]).to eq("/usr/bin/false") - expect(cask.artifacts[:installer].to_a[1].script[:args]).to eq(["--flag"]) + expect(cask.artifacts[:installer].first.path).to eq(Pathname("/usr/bin/true")) + expect(cask.artifacts[:installer].first.args[:args]).to eq(["--flag"]) + expect(cask.artifacts[:installer].to_a[1].path).to eq(Pathname("/usr/bin/false")) + expect(cask.artifacts[:installer].to_a[1].args[:args]).to eq(["--flag"]) end end @@ -482,7 +482,9 @@ describe Hbc::DSL, :cask do let(:token) { "with-installer-manual" } it "allows installer manual to be specified" do - expect(cask.artifacts[:installer].first.manual).to eq("Caffeine.app") + installer = cask.artifacts[:installer].first + expect(installer).to be_a(Hbc::Artifact::Installer::ManualInstaller) + expect(installer.path).to eq(cask.staged_path.join("Caffeine.app")) end end end @@ -492,7 +494,7 @@ describe Hbc::DSL, :cask do let(:token) { "stage-only" } it "allows stage_only stanza to be specified" do - expect(cask.artifacts[:stage_only].first).to eq([true]) + expect(cask.artifacts[:stage_only]).not_to be_empty end end @@ -518,7 +520,7 @@ describe Hbc::DSL, :cask do let(:token) { "appdir-interpolation" } it "is allowed" do - expect(cask.artifacts[:binary].first).to eq(["#{Hbc.appdir}/some/path"]) + expect(cask.artifacts[:binary].first.source).to eq(Hbc.appdir/"some/path") end end @@ -531,7 +533,7 @@ describe Hbc::DSL, :cask do binary "#{appdir}/some/path" end - expect(cask.artifacts[:binary].first).to eq(["#{original_appdir}/some/path"]) + expect(cask.artifacts[:binary].first.source).to eq(original_appdir/"some/path") ensure Hbc.appdir = original_appdir end |
