Class: Test::Unit::Assertions::AssertionMessage
- Defined in:
- lib/qualitysmith_extensions/test/difference_highlighting.rb
Constant Summary collapse
- @@inspect_strings =
false
Instance Method Summary collapse
-
#convert_with_option_to_not_use_inspect_for_strings(object) ⇒ Object
The problem with the original convert() is that it always called #inspect on strings…
Instance Method Details
#convert_with_option_to_not_use_inspect_for_strings(object) ⇒ Object
The problem with the original convert() is that it always called #inspect on strings… which is fine if you really want to see all those n‘s and such. But not so great if you want to visually compare the strings. And if you have ANSI color codes in the strings, it will escape those so that you see the codes (e[33m1) rather than the nice colored strings that you (sometimes) want to see…
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/qualitysmith_extensions/test/difference_highlighting.rb', line 81 def convert_with_option_to_not_use_inspect_for_strings(object) if String === object if self.class.inspect_strings? # Use the original method, which used pp or inspect convert_without_option_to_not_use_inspect_for_strings(object) else object end else # We only care about strings. Everything else can just keep happening like it was before. convert_without_option_to_not_use_inspect_for_strings(object) end end |