Make Compare#diffs diff_options a regular argument

This commit is contained in:
Douwe Maan 2016-08-03 09:32:01 -07:00
parent c86c1905b5
commit c008a1a967
5 changed files with 6 additions and 6 deletions

View file

@ -21,7 +21,7 @@ class Projects::CompareController < Projects::ApplicationController
def diff_for_path
return render_404 unless @compare
render_diff_for_path(@compare.diffs(diff_options: diff_options))
render_diff_for_path(@compare.diffs(diff_options))
end
def create
@ -45,7 +45,7 @@ class Projects::CompareController < Projects::ApplicationController
@commit = @compare.commit
@base_commit = @compare.base_commit
@diffs = @compare.diffs(diff_options: diff_options)
@diffs = @compare.diffs(diff_options)
@diff_notes_disabled = true
@grouped_diff_discussions = {}

View file

@ -49,7 +49,7 @@ class Compare
@compare.diffs(*args)
end
def diffs(diff_options:)
def diffs(diff_options = nil)
Gitlab::Diff::FileCollection::Compare.new(self,
project: project,
diff_options: diff_options,

View file

@ -170,7 +170,7 @@ class MergeRequest < ActiveRecord::Base
def diffs(diff_options = nil)
if self.compare
self.compare.diffs(diff_options: diff_options)
self.compare.diffs(diff_options)
else
Gitlab::Diff::FileCollection::MergeRequest.new(self, diff_options: diff_options)
end

View file

@ -42,7 +42,7 @@ module Gitlab
return unless compare
# This diff is more moderated in number of files and lines
@diffs ||= compare.diffs(diff_options: { max_files: 30, max_lines: 5000, no_collapse: true }).diff_files
@diffs ||= compare.diffs(max_files: 30, max_lines: 5000, no_collapse: true).diff_files
end
def diffs_count

View file

@ -171,7 +171,7 @@ describe MergeRequest, models: true do
it 'delegates to the compare object' do
merge_request.compare = double(:compare)
expect(merge_request.compare).to receive(:diffs).with(diff_options: options)
expect(merge_request.compare).to receive(:diffs).with(options)
merge_request.diffs(options)
end