diff options
| author | Markus Reiter | 2017-03-05 03:46:13 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-03-05 04:38:30 +0100 |
| commit | b7135eec493c1b2cad69b934bbf0d1aefbcbf8ab (patch) | |
| tree | 7b4a0bc394dc317025808a3f50d9ba320347ce18 /Library/Homebrew/cask/spec/support | |
| parent | 83188c625d7f179bb35839cf90b1b74956fb89af (diff) | |
| download | brew-b7135eec493c1b2cad69b934bbf0d1aefbcbf8ab.tar.bz2 | |
Move `shared_examples` and `matcher` into specs.
Diffstat (limited to 'Library/Homebrew/cask/spec/support')
| -rw-r--r-- | Library/Homebrew/cask/spec/support/audit_matchers.rb | 39 | ||||
| -rw-r--r-- | Library/Homebrew/cask/spec/support/expectations_hash_helper.rb | 10 |
2 files changed, 0 insertions, 49 deletions
diff --git a/Library/Homebrew/cask/spec/support/audit_matchers.rb b/Library/Homebrew/cask/spec/support/audit_matchers.rb deleted file mode 100644 index fc1e0e876..000000000 --- a/Library/Homebrew/cask/spec/support/audit_matchers.rb +++ /dev/null @@ -1,39 +0,0 @@ -module AuditMatchers - extend RSpec::Matchers::DSL - - matcher :pass do - match do |audit| - !audit.errors? && !audit.warnings? - end - end - - matcher :fail do - match(&:errors?) - end - - matcher :warn do - match do |audit| - audit.warnings? && !audit.errors? - end - end - - matcher :fail_with do |error_msg| - match do |audit| - include_msg?(audit.errors, error_msg) - end - end - - matcher :warn_with do |warning_msg| - match do |audit| - include_msg?(audit.warnings, warning_msg) - end - end - - def include_msg?(messages, msg) - if msg.is_a?(Regexp) - Array(messages).any? { |m| m =~ msg } - else - Array(messages).include?(msg) - end - end -end diff --git a/Library/Homebrew/cask/spec/support/expectations_hash_helper.rb b/Library/Homebrew/cask/spec/support/expectations_hash_helper.rb deleted file mode 100644 index 726b1d053..000000000 --- a/Library/Homebrew/cask/spec/support/expectations_hash_helper.rb +++ /dev/null @@ -1,10 +0,0 @@ -module ExpectationsHashHelper - shared_examples "expectations hash" do |input_name, expectations| - expectations.each do |input_value, expected_output| - context "when #{input_name} is #{input_value.inspect}" do - let(input_name.to_sym) { input_value } - it { is_expected.to eq expected_output } - end - end - end -end |
