homebrew-cask-versions/test/cask/artifact/binary_test.rb
Roland Walker ed5ea5ed4c recast install/uninstall methods: install_phase
and `uninstall_phase`, to improve clarity, now that we have an
independent `uninstall` artifact.
2014-06-18 20:22:24 -04:00

52 lines
1.1 KiB
Ruby

require 'test_helper'
describe Cask::Artifact::App do
let(:cask) {
Cask.load('with-binary').tap do |cask|
TestHelper.install_without_artifacts(cask)
end
}
let(:expected_path) {
Cask.binarydir/'binary'
}
it "links the binary to the proper directory" do
shutup do
Cask::Artifact::Binary.new(cask).install_phase
end
TestHelper.valid_alias?(expected_path).must_equal true
end
it "avoids clobbering an existing binary by linking over it" do
FileUtils.touch expected_path
shutup do
Cask::Artifact::Binary.new(cask).install_phase
end
expected_path.wont_be :symlink?
end
it "clobbers an existing symlink" do
expected_path.make_symlink('/tmp')
shutup do
Cask::Artifact::Binary.new(cask).install_phase
end
File.readlink(expected_path).wont_equal '/tmp'
end
it "respects --no-binaries flag" do
Cask.no_binaries = true
shutup do
Cask::Artifact::Binary.new(cask).install_phase
end
expected_path.exist?.must_equal false
Cask.no_binaries = false
end
end