diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2017-03-29 08:16:59 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-04-05 13:49:08 +0300 |
commit | fd8a40783d593993caa76925eae1d54e6fd95c4b (patch) | |
tree | 42584066f86ffe50638eaa37ececac598f58533e /spec/models/blob_spec.rb | |
parent | d4d95ad32fb1f47ecb4b6d0e8d9885dba0222453 (diff) |
Load a preview of Sketch 43 files
Sketch 43 files are technically a zip file, so the JavaScript opens the
zip file & locates a preview.png which is just a quick preview of the
last sketch page edited. After that is loaded it simply places the image
into the DOM
Diffstat (limited to 'spec/models/blob_spec.rb')
-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 552229e9b07..ba110383977 100644 --- a/spec/models/blob_spec.rb +++ b/spec/models/blob_spec.rb @@ -67,6 +67,20 @@ describe Blob do end end + describe '#sketch?' do + it 'is falsey with image extension' do + git_blob = Gitlab::Git::Blob.new(name: "design.png") + + expect(described_class.decorate(git_blob)).not_to be_sketch + end + + it 'is truthy with sketch extension' do + git_blob = Gitlab::Git::Blob.new(name: "design.sketch") + + expect(described_class.decorate(git_blob)).to be_sketch + end + end + describe '#video?' do it 'is falsey with image extension' do git_blob = Gitlab::Git::Blob.new(name: 'image.png') @@ -92,7 +106,8 @@ describe Blob do language: nil, lfs_pointer?: false, svg?: false, - text?: false + text?: false, + binary?: false ) described_class.decorate(double).tap do |blob| @@ -135,6 +150,11 @@ describe Blob do blob = stubbed_blob(text?: true, ipython_notebook?: true) expect(blob.to_partial_path(project)).to eq 'notebook' end + + it 'handles Sketch files' do + blob = stubbed_blob(text?: true, sketch?: true, binary?: true) + expect(blob.to_partial_path(project)).to eq 'sketch' + end end describe '#size_within_svg_limits?' do |