Commit b0f09406 authored by Sean McGivern's avatar Sean McGivern

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
......@@ -250,6 +250,8 @@ module Gitlab
DiffViewer::Renamed
elsif mode_changed?
DiffViewer::ModeChanged
else
DiffViewer::NoPreview
end
end
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment