summaryrefslogtreecommitdiff
path: root/spec/models/blob_viewer
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-05-12 14:43:06 -0500
committerDouwe Maan <douwe@selenight.nl>2017-05-13 11:46:10 -0500
commitacffc062133e5793ac08b9529ab54689557766d4 (patch)
tree019482c4b8af8fcd4a0dabf89a4c47c389e37730 /spec/models/blob_viewer
parent4328bc1769c52393580cb777d34dbd6ebff089cf (diff)
downloadgitlab-ce-acffc062133e5793ac08b9529ab54689557766d4.tar.gz
Specify explicitly whether a blob viewer should be loaded asynchronously
Diffstat (limited to 'spec/models/blob_viewer')
-rw-r--r--spec/models/blob_viewer/base_spec.rb21
-rw-r--r--spec/models/blob_viewer/server_side_spec.rb16
2 files changed, 20 insertions, 17 deletions
diff --git a/spec/models/blob_viewer/base_spec.rb b/spec/models/blob_viewer/base_spec.rb
index a6641970e1b..b3dc3252963 100644
--- a/spec/models/blob_viewer/base_spec.rb
+++ b/spec/models/blob_viewer/base_spec.rb
@@ -7,11 +7,12 @@ describe BlobViewer::Base, model: true do
let(:viewer_class) do
Class.new(described_class) do
+ include BlobViewer::ServerSide
+
self.extensions = %w(pdf)
self.binary = true
self.max_size = 1.megabyte
self.absolute_max_size = 5.megabytes
- self.client_side = false
end
end
@@ -38,10 +39,10 @@ describe BlobViewer::Base, model: true do
context 'when the file type is supported' do
before do
- viewer_class.file_type = :license
+ viewer_class.file_types = %i(license)
viewer_class.binary = false
end
-
+
context 'when the binaryness matches' do
let(:blob) { fake_blob(path: 'LICENSE', binary: false) }
@@ -172,19 +173,5 @@ describe BlobViewer::Base, model: true do
end
end
end
-
- context 'when the viewer is server side but the blob is stored externally' do
- let(:project) { build(:empty_project, lfs_enabled: true) }
-
- let(:blob) { fake_blob(path: 'file.pdf', lfs: true) }
-
- before do
- allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
- end
-
- it 'return :server_side_but_stored_externally' do
- expect(viewer.render_error).to eq(:server_side_but_stored_externally)
- end
- end
end
end
diff --git a/spec/models/blob_viewer/server_side_spec.rb b/spec/models/blob_viewer/server_side_spec.rb
index ddca9b79390..f047953d540 100644
--- a/spec/models/blob_viewer/server_side_spec.rb
+++ b/spec/models/blob_viewer/server_side_spec.rb
@@ -22,4 +22,20 @@ describe BlobViewer::ServerSide, model: true do
subject.prepare!
end
end
+
+ describe '#render_error' do
+ context 'when the blob is stored externally' do
+ let(:project) { build(:empty_project, lfs_enabled: true) }
+
+ let(:blob) { fake_blob(path: 'file.pdf', lfs: true) }
+
+ before do
+ allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
+ end
+
+ it 'return :server_side_but_stored_externally' do
+ expect(subject.render_error).to eq(:server_side_but_stored_externally)
+ end
+ end
+ end
end