diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-08-02 15:21:41 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-08-02 15:21:41 -0500 |
commit | 184cce4d0d304cf6c39e888c27e1007a5acd2f74 (patch) | |
tree | 21883821cb892a19502e94bef684045d03ea1662 /spec/support/matchers.rb | |
parent | 220695122ff4de38a941afb8153f18f8b6667658 (diff) | |
download | bundler-184cce4d0d304cf6c39e888c27e1007a5acd2f74.tar.gz |
Fix precondition negated matchingseg-unhack-viz
Diffstat (limited to 'spec/support/matchers.rb')
-rw-r--r-- | spec/support/matchers.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 1e418e1fc2..9476f18984 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -13,7 +13,6 @@ module Spec :actual, :description, :diffable?, - :does_not_match?, :expected, :failure_message_when_negated @@ -24,8 +23,17 @@ module Spec end def matches?(target, &blk) - @failure_index = @preconditions.index {|pc| !pc.matches?(target, &blk) } - !@failure_index && @matcher.matches?(target, &blk) + return false if @failure_index = @preconditions.index {|pc| !pc.matches?(target, &blk) } + @matcher.matches?(target, &blk) + end + + def does_not_match?(target, &blk) + return false if @failure_index = @preconditions.index {|pc| !pc.matches?(target, &blk) } + if @matcher.respond_to?(:does_not_match?) + @matcher.does_not_match?(target, &blk) + else + !@matcher.matches?(target, &blk) + end end def expects_call_stack_jump? |