Created
October 30, 2017 19:20
-
-
Save jcmuller/7b27a7c2213c320ebcd367378967c4db to your computer and use it in GitHub Desktop.
Show long errors in RSpec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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