diff options
author | Sean McGivern <sean@gitlab.com> | 2017-08-22 16:04:54 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-08-22 16:04:54 +0300 |
commit | b0f09406f50882c7e085c2a9b853be5dcf3d79dd (patch) | |
tree | 426166f1d84ca3e9352cd07a5c50ef2ae01e617c /spec/lib/gitlab/diff | |
parent | ce89c425fe51d2317322350bbd8a364c08d97d21 (diff) |
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.
Diffstat (limited to 'spec/lib/gitlab/diff')
-rw-r--r-- | spec/lib/gitlab/diff/file_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/lib/gitlab/diff/file_spec.rb b/spec/lib/gitlab/diff/file_spec.rb index d3d841b0668..ab60d62d88e 100644 --- a/spec/lib/gitlab/diff/file_spec.rb +++ b/spec/lib/gitlab/diff/file_spec.rb @@ -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 |