diff options
author | Phil Hughes <me@iamphill.com> | 2017-03-31 18:03:56 +0100 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2017-04-05 10:52:27 -0400 |
commit | 1944bb6a23ac61b347b250c9eb389029b2c2e894 (patch) | |
tree | bd99914591a21153a27645a4a245d92b1fb72a5b | |
parent | c549e629daf7ff9ecf4bb11dba40a509a26bc718 (diff) | |
download | gitlab-ce-3d-file-viewer.tar.gz |
Blob model file spec3d-file-viewer
-rw-r--r-- | spec/models/blob_spec.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/models/blob_spec.rb b/spec/models/blob_spec.rb index ba110383977..7c775b2e116 100644 --- a/spec/models/blob_spec.rb +++ b/spec/models/blob_spec.rb @@ -97,6 +97,20 @@ describe Blob do end end + describe '#stl?' do + it 'is falsey with image extension' do + git_blob = Gitlab::Git::Blob.new(name: 'file.png') + + expect(described_class.decorate(git_blob)).not_to be_stl + end + + it 'is truthy with STL extension' do + git_blob = Gitlab::Git::Blob.new(name: 'file.stl') + + expect(described_class.decorate(git_blob)).to be_stl + end + end + describe '#to_partial_path' do let(:project) { double(lfs_enabled?: true) } @@ -107,7 +121,8 @@ describe Blob do lfs_pointer?: false, svg?: false, text?: false, - binary?: false + binary?: false, + stl?: false ) described_class.decorate(double).tap do |blob| @@ -155,6 +170,11 @@ describe Blob do blob = stubbed_blob(text?: true, sketch?: true, binary?: true) expect(blob.to_partial_path(project)).to eq 'sketch' end + + it 'handles STLs' do + blob = stubbed_blob(text?: true, stl?: true) + expect(blob.to_partial_path(project)).to eq 'stl' + end end describe '#size_within_svg_limits?' do |