diff --git a/lib/rspec/expectations/differ.rb b/lib/rspec/expectations/differ.rb index 4706b0fc4..ac3201b49 100644 --- a/lib/rspec/expectations/differ.rb +++ b/lib/rspec/expectations/differ.rb @@ -16,6 +16,9 @@ def diff_as_string(input_data_new, input_data_old) file_length_difference = 0 diffs.each do |piece| begin + if data_old == [] + data_old = [""] + end hunk = Diff::LCS::Hunk.new( data_old, data_new, piece, context_lines, file_length_difference )