Skip to content

Instantly share code, notes, and snippets.

@jcmuller
Created October 30, 2017 19:20
Show Gist options
  • Save jcmuller/7b27a7c2213c320ebcd367378967c4db to your computer and use it in GitHub Desktop.
Save jcmuller/7b27a7c2213c320ebcd367378967c4db to your computer and use it in GitHub Desktop.
Show long errors in RSpec
RSpec::Matchers.define :eq_long_string do |expected|
match do |string|
expected == string
end
failure_message do |actual|
"Failed with [#{actual}]\n\n" \
"Expected [#{expected}]"
end
failure_message_when_negated do |actual|
"Failed with [#{actual}]\n\n" \
"Expected [#{expected}]"
end
description do
"Comparing long strings"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment