summaryrefslogtreecommitdiff
path: root/spec/support/matchers.rb
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2011-03-31 11:06:18 -0700
committerAndre Arko <andre@arko.net>2011-03-31 11:06:18 -0700
commit25f802e7c24f4dc938f22ccf4fdf008660776128 (patch)
treeb372467e73cb489c8196a4e2017d517adf439a18 /spec/support/matchers.rb
parentf7b7cc6920ad12fc1ea198bcdcb10eca2f8dcbd6 (diff)
downloadbundler-25f802e7c24f4dc938f22ccf4fdf008660776128.tar.gz
switch lockfile matcher to rspec == and get string diffs for free
Diffstat (limited to 'spec/support/matchers.rb')
-rw-r--r--spec/support/matchers.rb18
1 files changed, 3 insertions, 15 deletions
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
index 429faa07cb..be6837fc82 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -67,23 +67,11 @@ module Spec
bundled_app("Gemfile.lock").should exist
end
- RSpec::Matchers.define :be_with_diff do |expected|
+ def lockfile_should_be(expected)
+ should_be_locked
spaces = expected[/\A\s+/, 0] || ""
expected.gsub!(/^#{spaces}/, '')
-
- failure_message_for_should do |actual|
- "The lockfile did not match.\n=== Expected:\n" <<
- expected << "\n=== Got:\n" << actual << "\n===========\n"
- end
-
- match do |actual|
- expected == actual
- end
- end
-
- def lockfile_should_be(expected)
- lock = File.read(bundled_app("Gemfile.lock"))
- lock.should be_with_diff(expected)
+ bundled_app("Gemfile.lock").read.should == expected
end
end
end