Skip to content
Snippets Groups Projects
Commit f810bf6b authored by Markus Reiter's avatar Markus Reiter Committed by GitHub
Browse files

Merge pull request #1969 from reitermarkus/valid-symlink

Create custom matchers for “valid symlink”.
parents 9aa4888d 31c51108
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,8 @@ describe Hbc::Artifact::Binary do
shutup do
Hbc::Artifact::Binary.new(cask).install_phase
end
expect(FileHelper.valid_alias?(expected_path)).to be true
expect(expected_path).to be_a_symlink
expect(expected_path.readlink).to exist
end
it "avoids clobbering an existing binary by linking over it" do
......@@ -82,7 +83,8 @@ describe Hbc::Artifact::Binary do
Hbc::Artifact::Binary.new(cask).install_phase
end
expect(FileHelper.valid_alias?(expected_path)).to be true
expect(expected_path).to be_a_symlink
expect(expected_path.readlink).to exist
end
end
end
module FileHelper
module_function
def valid_alias?(candidate)
return false unless candidate.symlink?
candidate.readlink.exist?
end
end
......@@ -20,7 +20,7 @@ describe Hbc::Artifact::Suite do
end
target_path.must_be :directory?
TestHelper.valid_alias?(target_path).must_equal false
TestHelper.valid_symlink?(target_path).must_equal false
source_path.wont_be :exist?
end
......
......@@ -58,7 +58,7 @@ class TestHelper
"file://" + local_binary_path(name)
end
def self.valid_alias?(candidate)
def self.valid_symlink?(candidate)
return false unless candidate.symlink?
candidate.readlink.exist?
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment