From d431a4d7a6981cd80fdbf72b4ce6d73b26a1bdf3 Mon Sep 17 00:00:00 2001 From: Benjamin Fleischer Date: Fri, 26 Dec 2014 13:45:22 -0600 Subject: [PATCH] The Differ no longer catches CompatibilityErrors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was introduced in https://github.com/rspec/rspec-expectations/pull/220/files#diff-9533f5f156a38a3307ecfc610d2282d7R47 but is no longer raised either by the the current test code, the original test code @expected="Tu avec carté {count} itém has".encode('UTF-16LE') @actual="Tu avec carte {count} item has".encode('UTF-16LE') or any other variations I've tried Since I'm moving all the encoding logic into EncodedString, and this doesn't appear to do anything any more, I am proposing to remove it. Next commits will also move over #pick_encoding Conflicts: spec/rspec/support/differ_spec.rb --- lib/rspec/support/differ.rb | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/rspec/support/differ.rb b/lib/rspec/support/differ.rb index c6f5cadaf..56dc7e562 100644 --- a/lib/rspec/support/differ.rb +++ b/lib/rspec/support/differ.rb @@ -51,8 +51,6 @@ def diff_as_string(actual, expected) finalize_output(output, hunks.last.diff(format_type).to_s) if hunks.last color_diff output - rescue Encoding::CompatibilityError - handle_encoding_errors end # rubocop:enable MethodLength @@ -202,17 +200,6 @@ def pick_encoding(source_a, source_b) def pick_encoding(_source_a, _source_b) end end - - def handle_encoding_errors - if @actual.source_encoding != @expected.source_encoding - "Could not produce a diff because the encoding of the actual string " \ - "(#{@actual.source_encoding}) differs from the encoding of the expected " \ - "string (#{@expected.source_encoding})" - else - "Could not produce a diff because of the encoding of the string " \ - "(#{@expected.source_encoding})" - end - end end # rubocop:enable ClassLength end