Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel <alexis.reigel.ext@siemens.com>2018-04-12 15:11:21 +0300
committerAlexis Reigel <mail@koffeinfrei.org>2018-06-05 17:20:23 +0300
commit256d959729f14094a490c102508e2878c1dd87fc (patch)
tree5ea1e7db73b01687acc7880feda4fa8a2b8d9bd7 /spec/controllers
parent46328b1242d6508f7ee13c6b6e40d9aad6af07ea (diff)
ability to get an image's alternative version
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/uploads_controller_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/controllers/uploads_controller_spec.rb b/spec/controllers/uploads_controller_spec.rb
index 376b229ffc9..ae62039fb32 100644
--- a/spec/controllers/uploads_controller_spec.rb
+++ b/spec/controllers/uploads_controller_spec.rb
@@ -560,5 +560,27 @@ describe UploadsController do
end
end
end
+
+ context 'the version filename must match' do
+ let!(:appearance) { create :appearance, favicon: fixture_file_upload(Rails.root.join('spec/fixtures/dk.png'), 'image/png') }
+
+ context 'has a valid filename on the version file' do
+ it 'successfully returns the file' do
+ get :show, model: 'appearance', mounted_as: 'favicon', id: appearance.id, filename: 'favicon_main_dk.png'
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(response.header['Content-Disposition']).to eq 'inline; filename="favicon_main_dk.png"'
+ end
+ end
+
+ context 'has an invalid filename on the version file' do
+ it 'returns the original file' do
+ get :show, model: 'appearance', mounted_as: 'favicon', id: appearance.id, filename: 'favicon_bogusversion_dk.png'
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(response.header['Content-Disposition']).to eq 'inline; filename="dk.png"'
+ end
+ end
+ end
end
end