diff options
author | Sam Rose <sam@gitlab.com> | 2017-04-03 21:39:50 +0300 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2017-04-05 18:22:12 +0300 |
commit | dad30d6bbf9816993bf999edcc7b1a7203a3eae5 (patch) | |
tree | a8b75a1fc2bbe22d54da02c0396ba2089ff7360b /spec/models/blob_spec.rb | |
parent | 97667b83420cf42b01836d9b0c46d904f55aae21 (diff) |
Use PDFLab to render PDFs in GitLab
Diffstat (limited to 'spec/models/blob_spec.rb')
-rw-r--r-- | spec/models/blob_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/blob_spec.rb b/spec/models/blob_spec.rb index ba110383977..09b1fda3796 100644 --- a/spec/models/blob_spec.rb +++ b/spec/models/blob_spec.rb @@ -53,6 +53,20 @@ describe Blob do end end + describe '#pdf?' do + it 'is falsey when file extension is not .pdf' do + git_blob = double(name: 'git_blob.txt') + + expect(described_class.decorate(git_blob)).not_to be_pdf + end + + it 'is truthy when file extension is .pdf' do + git_blob = double(name: 'git_blob.pdf') + + expect(described_class.decorate(git_blob)).to be_pdf + end + end + describe '#ipython_notebook?' do it 'is falsey when language is not Jupyter Notebook' do git_blob = double(text?: true, language: double(name: 'JSON')) @@ -102,6 +116,7 @@ describe Blob do def stubbed_blob(overrides = {}) overrides.reverse_merge!( + name: nil, image?: false, language: nil, lfs_pointer?: false, @@ -146,6 +161,11 @@ describe Blob do expect(blob.to_partial_path(project)).to eq 'download' end + it 'handles PDFs' do + blob = stubbed_blob(name: 'blob.pdf', pdf?: true) + expect(blob.to_partial_path(project)).to eq 'pdf' + end + it 'handles iPython notebooks' do blob = stubbed_blob(text?: true, ipython_notebook?: true) expect(blob.to_partial_path(project)).to eq 'notebook' |