Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

switch lockfile matcher to rspec == and get string diffs for free

  • Loading branch information...
commit 25f802e7c24f4dc938f22ccf4fdf008660776128 1 parent f7b7cc6
@indirect indirect authored
Showing with 3 additions and 15 deletions.
  1. +3 −15 spec/support/matchers.rb
View
18 spec/support/matchers.rb
@@ -67,23 +67,11 @@ def should_be_locked
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
Please sign in to comment.
Something went wrong with that request. Please try again.