summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/install/upgrade_spec.rb2
-rw-r--r--spec/support/matchers.rb14
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?