Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-07-27 20:00:34 +0300
committerPaco Guzman <pacoguzmanp@gmail.com>2016-08-03 08:00:20 +0300
commitc86c1905b5574cac234315598d8d715fcaee3ea7 (patch)
tree31ba7ab51c04b07ea70d15db88f2370f9ca6359e /spec/helpers
parent1d0c7b74920a94e488e6a2c090abb3e525438053 (diff)
switch from diff_file_collection to diffs
So we have raw_diffs too
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/diff_helper_spec.rb24
1 files changed, 13 insertions, 11 deletions
diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb
index c2fd2c8a533..4949280d641 100644
--- a/spec/helpers/diff_helper_spec.rb
+++ b/spec/helpers/diff_helper_spec.rb
@@ -6,7 +6,7 @@ describe DiffHelper do
let(:project) { create(:project) }
let(:repository) { project.repository }
let(:commit) { project.commit(sample_commit.id) }
- let(:diffs) { commit.diffs }
+ let(:diffs) { commit.raw_diffs }
let(:diff) { diffs.first }
let(:diff_refs) { [commit.parent, commit] }
let(:diff_file) { Gitlab::Diff::File.new(diff, diff_refs: diff_refs, repository: repository) }
@@ -32,16 +32,6 @@ describe DiffHelper do
end
describe 'diff_options' do
- it 'should return hard limit for a diff if force diff is true' do
- allow(controller).to receive(:params) { { force_show_diff: true } }
- expect(diff_options).to include(Commit.max_diff_options)
- end
-
- it 'should return hard limit for a diff if expand_all_diffs is true' do
- allow(controller).to receive(:params) { { expand_all_diffs: true } }
- expect(diff_options).to include(Commit.max_diff_options)
- end
-
it 'should return no collapse false' do
expect(diff_options).to include(no_collapse: false)
end
@@ -55,6 +45,18 @@ describe DiffHelper do
allow(controller).to receive(:action_name) { 'diff_for_path' }
expect(diff_options).to include(no_collapse: true)
end
+
+ it 'should return paths if action name diff_for_path and param old path' do
+ allow(controller).to receive(:params) { { old_path: 'lib/wadus.rb' } }
+ allow(controller).to receive(:action_name) { 'diff_for_path' }
+ expect(diff_options[:paths]).to include('lib/wadus.rb')
+ end
+
+ it 'should return paths if action name diff_for_path and param new path' do
+ allow(controller).to receive(:params) { { new_path: 'lib/wadus.rb' } }
+ allow(controller).to receive(:action_name) { 'diff_for_path' }
+ expect(diff_options[:paths]).to include('lib/wadus.rb')
+ end
end
describe 'unfold_bottom_class' do