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 | |
parent | 220695122ff4de38a941afb8153f18f8b6667658 (diff) | |
download | bundler-184cce4d0d304cf6c39e888c27e1007a5acd2f74.tar.gz |
Fix precondition negated matchingseg-unhack-viz
-rw-r--r-- | spec/install/upgrade_spec.rb | 2 | ||||
-rw-r--r-- | spec/support/matchers.rb | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/spec/install/upgrade_spec.rb b/spec/install/upgrade_spec.rb index 852a746322..d979b97647 100644 --- a/spec/install/upgrade_spec.rb +++ b/spec/install/upgrade_spec.rb @@ -14,7 +14,7 @@ describe "bundle install for the first time with v1.0" do it "removes lockfiles in 0.9 YAML format" do File.open("Gemfile.lock", "w") {|f| YAML.dump({}, f) } bundle :install - expect(File.read("Gemfile.lock")).not_to match(/^---/) + expect(Pathname.new("Gemfile.lock")).not_to read_as(a_string_starting_with("---")) end it "removes env.rb if it exists" do 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? |