Skip to content

Instantly share code, notes, and snippets.

@mz026
Created February 19, 2014 07:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mz026/9087682 to your computer and use it in GitHub Desktop.
RSpec::Matchers.define :has_the_same_format_as do |expected|
result = nil
match do |actual|
police = HashPolice::Police.new(expected)
result = police.check(actual)
result.passed?
end
failure_message_for_should do |actual|
result.error_messages
end
end
actual.should has_the_same_format_as(expected)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment