Skip to content
Snippets Groups Projects
Commit b0f09406 authored by Sean McGivern's avatar Sean McGivern
Browse files

Always return a simple diff viewer

We didn't have a fallback case before, because we believed the conditions were
exhaustive. They weren't, so we can always fallback to not previewing.
parent ce89c425
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -250,6 +250,8 @@ module Gitlab
DiffViewer::Renamed
elsif mode_changed?
DiffViewer::ModeChanged
else
DiffViewer::NoPreview
end
end
 
Loading
Loading
Loading
Loading
@@ -270,6 +270,20 @@ describe Gitlab::Diff::File do
expect(diff_file.simple_viewer).to be_a(DiffViewer::ModeChanged)
end
end
context 'when no other conditions apply' do
before do
allow(diff_file).to receive(:content_changed?).and_return(false)
allow(diff_file).to receive(:new_file?).and_return(false)
allow(diff_file).to receive(:deleted_file?).and_return(false)
allow(diff_file).to receive(:renamed_file?).and_return(false)
allow(diff_file).to receive(:mode_changed?).and_return(false)
end
it 'returns a No Preview viewer' do
expect(diff_file.simple_viewer).to be_a(DiffViewer::NoPreview)
end
end
end
 
describe '#rich_viewer' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment