summaryrefslogtreecommitdiff
path: root/spec/models/blob_spec.rb
diff options
context:
space:
mode:
authorJacob Schatz <jschatz1@gmail.com>2017-03-29 01:16:59 -0400
committerPhil Hughes <me@iamphill.com>2017-04-05 11:49:08 +0100
commitfd8a40783d593993caa76925eae1d54e6fd95c4b (patch)
tree42584066f86ffe50638eaa37ececac598f58533e /spec/models/blob_spec.rb
parentd4d95ad32fb1f47ecb4b6d0e8d9885dba0222453 (diff)
downloadgitlab-ce-fd8a40783d593993caa76925eae1d54e6fd95c4b.tar.gz
Load a preview of Sketch 43 filessketch-preview-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.rb22
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