aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-09 21:37:03 +0100
committerGitHub2017-02-09 21:37:03 +0100
commitf810bf6bcdd48fda0cac5944d661a863fbf61b5c (patch)
tree99176f95ea48da8e7ee1b06b557562420e794353 /Library
parent9aa4888d2b45c7a07a95183cc4c026d828391914 (diff)
parent31c51108ce43ae97f6b8c061be90ccc1a567010b (diff)
downloadbrew-f810bf6bcdd48fda0cac5944d661a863fbf61b5c.tar.bz2
Merge pull request #1969 from reitermarkus/valid-symlink
Create custom matchers for “valid symlink”.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/spec/cask/artifact/binary_spec.rb6
-rw-r--r--Library/Homebrew/cask/spec/support/file_helper.rb8
-rw-r--r--Library/Homebrew/cask/test/cask/artifact/suite_test.rb2
-rw-r--r--Library/Homebrew/cask/test/test_helper.rb2
4 files changed, 6 insertions, 12 deletions
diff --git a/Library/Homebrew/cask/spec/cask/artifact/binary_spec.rb b/Library/Homebrew/cask/spec/cask/artifact/binary_spec.rb
index 95ac2b5f5..c27dcc8f0 100644
--- a/Library/Homebrew/cask/spec/cask/artifact/binary_spec.rb
+++ b/Library/Homebrew/cask/spec/cask/artifact/binary_spec.rb
@@ -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
diff --git a/Library/Homebrew/cask/spec/support/file_helper.rb b/Library/Homebrew/cask/spec/support/file_helper.rb
deleted file mode 100644
index abe7b2618..000000000
--- a/Library/Homebrew/cask/spec/support/file_helper.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-module FileHelper
- module_function
-
- def valid_alias?(candidate)
- return false unless candidate.symlink?
- candidate.readlink.exist?
- end
-end
diff --git a/Library/Homebrew/cask/test/cask/artifact/suite_test.rb b/Library/Homebrew/cask/test/cask/artifact/suite_test.rb
index 0584dcbeb..6259baa4b 100644
--- a/Library/Homebrew/cask/test/cask/artifact/suite_test.rb
+++ b/Library/Homebrew/cask/test/cask/artifact/suite_test.rb
@@ -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
diff --git a/Library/Homebrew/cask/test/test_helper.rb b/Library/Homebrew/cask/test/test_helper.rb
index 71ce5752e..f600a1c5c 100644
--- a/Library/Homebrew/cask/test/test_helper.rb
+++ b/Library/Homebrew/cask/test/test_helper.rb
@@ -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