Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix encoding regression caused by shadowing variables and some typos

  • Loading branch information...
commit a9d825f41ba919e6279cffcabca9ca79acb3f32b 1 parent cbe881d
Jon Rowe JonRowe authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/rspec/expectations/differ.rb
6 lib/rspec/expectations/differ.rb
View
@@ -7,10 +7,10 @@ module Expectations
class Differ
# This is snagged from diff/lcs/ldiff.rb (which is a commandline tool)
def diff_as_string(data_new, data_old)
+ output = matching_encoding("", data_old)
data_old = data_old.split(matching_encoding("\n", data_old)).map! { |e| e.chomp }
data_new = data_new.split(matching_encoding("\n", data_new)).map! { |e| e.chomp }
diffs = Diff::LCS.diff(data_old, data_new)
- output = matching_encoding("", data_old)
return output if diffs.empty?
oldhunk = hunk = nil
file_length_difference = 0
@@ -37,11 +37,11 @@ def diff_as_string(data_new, data_old)
end
ensure
oldhunk = hunk
- output << matching_encoding("\n", aldhunk)
+ output << matching_encoding("\n", output)
end
end
#Handle the last remaining hunk
- output << oldhunk.diff(format) << matching_encoding("\n", oldhunk)
+ output << oldhunk.diff(format) << matching_encoding("\n", output)
color_diff output
end
Please sign in to comment.
Something went wrong with that request. Please try again.