Skip to content

Commit

Permalink
The Differ no longer catches CompatibilityErrors
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bf4 committed Jan 6, 2015
1 parent 78b032e commit d431a4d
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions lib/rspec/support/differ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d431a4d

Please sign in to comment.