From 78d7c0e0d81c40e0d9541e4ef0dd15df30d457e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rub=C3=A9n=20D=C3=A1vila?= <rdavila84@gmail.com>
Date: Fri, 8 Jan 2016 19:05:55 -0500
Subject: [PATCH] Fix broken specs. #3945

---
 app/views/projects/diffs/_parallel_view.html.haml |  4 ++--
 lib/gitlab/diff/highlight.rb                      | 10 +++++-----
 spec/helpers/diff_helper_spec.rb                  |  3 ++-
 spec/lib/gitlab/diff/file_spec.rb                 |  2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/app/views/projects/diffs/_parallel_view.html.haml b/app/views/projects/diffs/_parallel_view.html.haml
index 1ad54d1848b..77069501d1c 100644
--- a/app/views/projects/diffs/_parallel_view.html.haml
+++ b/app/views/projects/diffs/_parallel_view.html.haml
@@ -20,7 +20,7 @@
             = link_to raw(line_number_left), "##{line_code_left}", id: line_code_left
             - if @comments_allowed && can?(current_user, :create_note, @project)
               = link_to_new_diff_note(line_code_left, 'old')
-            %td.line_content{class: "parallel noteable_line #{type_left} #{line_code_left}", "line_code" => line_code_left }= line_content_left.html_safe
+            %td.line_content{class: "parallel noteable_line #{type_left} #{line_code_left}", "line_code" => line_code_left }= raw(line_content_left)
 
           - if type_right == 'new'
             - new_line_class = 'new'
@@ -33,7 +33,7 @@
             = link_to raw(line_number_right), "##{new_line_code}", id: new_line_code
             - if @comments_allowed && can?(current_user, :create_note, @project)
               = link_to_new_diff_note(line_code_right, 'new')
-            %td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", "line_code" => new_line_code}= line_content_right.html_safe
+            %td.line_content.parallel{class: "noteable_line #{new_line_class} #{new_line_code}", "line_code" => new_line_code}= raw(line_content_right)
 
       - if @reply_allowed
         - comments_left, comments_right = organize_comments(type_left, type_right, line_code_left, line_code_right)
diff --git a/lib/gitlab/diff/highlight.rb b/lib/gitlab/diff/highlight.rb
index 7dd44b6004a..caeefe5bbdd 100644
--- a/lib/gitlab/diff/highlight.rb
+++ b/lib/gitlab/diff/highlight.rb
@@ -27,11 +27,11 @@ module Gitlab
 
       def self.formatter
         @formatter ||= Rouge::Formatters::HTMLGitlab.new(
-                         nowrap: true,
-                         cssclass: 'code highlight',
-                         lineanchors: true,
-                         lineanchorsid: 'LC'
-                       )
+          nowrap: true,
+          cssclass: 'code highlight',
+          lineanchors: true,
+          lineanchorsid: 'LC'
+        )
       end
 
       def initialize(diff_file)
diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb
index 0501c2e8c29..84b8f4d1679 100644
--- a/spec/helpers/diff_helper_spec.rb
+++ b/spec/helpers/diff_helper_spec.rb
@@ -7,7 +7,8 @@ describe DiffHelper do
   let(:commit) { project.commit(sample_commit.id) }
   let(:diffs) { commit.diffs }
   let(:diff) { diffs.first }
-  let(:diff_file) { Gitlab::Diff::File.new(diff) }
+  let(:diff_refs) { [commit.parent.id, commit.id] }
+  let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs, project.repository) }
 
   describe 'diff_hard_limit_enabled?' do
     it 'should return true if param is provided' do
diff --git a/spec/lib/gitlab/diff/file_spec.rb b/spec/lib/gitlab/diff/file_spec.rb
index c7cdf8691d6..97ba7f14eb1 100644
--- a/spec/lib/gitlab/diff/file_spec.rb
+++ b/spec/lib/gitlab/diff/file_spec.rb
@@ -6,7 +6,7 @@ describe Gitlab::Diff::File, lib: true do
   let(:project) { create(:project) }
   let(:commit) { project.commit(sample_commit.id) }
   let(:diff) { commit.diffs.first }
-  let(:diff_file) { Gitlab::Diff::File.new(diff) }
+  let(:diff_file) { Gitlab::Diff::File.new(diff, [commit.parent.id, commit.id], project.repository) }
 
   describe :diff_lines do
     let(:diff_lines) { diff_file.diff_lines }
-- 
GitLab