diff options
author | Paco Guzman <pacoguzmanp@gmail.com> | 2016-07-26 09:21:42 +0200 |
---|---|---|
committer | Paco Guzman <pacoguzmanp@gmail.com> | 2016-08-03 07:00:20 +0200 |
commit | 8f359ea9170b984ad43d126e17628c31ac3a1f14 (patch) | |
tree | ee47d5172537ddedabc2cc38ef3cb5bf966c89ee /spec/controllers/projects/compare_controller_spec.rb | |
parent | cd7c2cb6ddd4d9c9f9bdae00c887c0022c121c17 (diff) | |
download | gitlab-ce-8f359ea9170b984ad43d126e17628c31ac3a1f14.tar.gz |
Move to Gitlab::Diff::FileCollection
Instead calling diff_collection.count use diff_collection.size which is cache on the diff_collection
Diffstat (limited to 'spec/controllers/projects/compare_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects/compare_controller_spec.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb index 6272a5f111d..ed4cc36de58 100644 --- a/spec/controllers/projects/compare_controller_spec.rb +++ b/spec/controllers/projects/compare_controller_spec.rb @@ -32,10 +32,11 @@ describe Projects::CompareController do w: 1) expect(response).to be_success - expect(assigns(:diffs).diff_files.first).not_to be_nil + diff_file = assigns(:diffs).diff_files.first + expect(diff_file).not_to be_nil expect(assigns(:commits).length).to be >= 1 # without whitespace option, there are more than 2 diff_splits - diff_splits = assigns(:diffs).diff_files.first.diff.diff.split("\n") + diff_splits = diff_file.diff.diff.split("\n") expect(diff_splits.length).to be <= 2 end @@ -87,9 +88,9 @@ describe Projects::CompareController do end it 'only renders the diffs for the path given' do - expect(controller).to receive(:render_diff_for_path).and_wrap_original do |meth, safe_diffs| - expect(safe_diffs.diff_files.map(&:new_path)).to contain_exactly(existing_path) - meth.call(safe_diffs) + expect(controller).to receive(:render_diff_for_path).and_wrap_original do |meth, diffs| + expect(diffs.diff_files.map(&:new_path)).to contain_exactly(existing_path) + meth.call(diffs) end diff_for_path(from: ref_from, to: ref_to, old_path: existing_path, new_path: existing_path) |