aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cask/artifact/binary_spec.rb
diff options
context:
space:
mode:
authorMarkus Reiter2017-04-06 00:33:31 +0200
committerMarkus Reiter2017-09-10 23:12:32 +0200
commit53ecdd843f6e6d6dd93e09a5394de3c31bc0e51a (patch)
tree052898092af480f6fd184870c4cdb8203f67662e /Library/Homebrew/test/cask/artifact/binary_spec.rb
parent5bcce735ddd7b68da6bde7dec6ca318c7801aade (diff)
downloadbrew-53ecdd843f6e6d6dd93e09a5394de3c31bc0e51a.tar.bz2
Treat every `Artifact` instance as a single artifact.
Diffstat (limited to 'Library/Homebrew/test/cask/artifact/binary_spec.rb')
-rw-r--r--Library/Homebrew/test/cask/artifact/binary_spec.rb21
1 files changed, 14 insertions, 7 deletions
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