aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/spec/support
diff options
context:
space:
mode:
authorMarkus Reiter2017-02-08 07:14:28 +0100
committerMarkus Reiter2017-02-08 07:14:28 +0100
commit6cd36428505b1b3548b1e15fe7e0a850b2e2aeaa (patch)
tree219069b8c2f5fde8a064004836abbc23e959afbe /Library/Homebrew/cask/spec/support
parent11abfc39ab593a525663c9dc7f24a9a93fb895e4 (diff)
downloadbrew-6cd36428505b1b3548b1e15fe7e0a850b2e2aeaa.tar.bz2
Create custom matchers for “valid symlink”.
Diffstat (limited to 'Library/Homebrew/cask/spec/support')
-rw-r--r--Library/Homebrew/cask/spec/support/file_helper.rb8
-rw-r--r--Library/Homebrew/cask/spec/support/file_matchers.rb9
2 files changed, 9 insertions, 8 deletions
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/spec/support/file_matchers.rb b/Library/Homebrew/cask/spec/support/file_matchers.rb
new file mode 100644
index 000000000..d3e62f45a
--- /dev/null
+++ b/Library/Homebrew/cask/spec/support/file_matchers.rb
@@ -0,0 +1,9 @@
+module FileMatchers
+ extend RSpec::Matchers::DSL
+
+ matcher :be_a_valid_symlink do
+ match do |path|
+ path.symlink? && path.readlink.exist?
+ end
+ end
+end