diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 21:06:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 21:06:49 +0300 |
commit | ab7cf450ba19cf80b9534f25dc707b33845e3014 (patch) | |
tree | bbfa6aba83c48aea68d79c4179ce576b6eec326d /spec/support/shared_examples/controllers | |
parent | 4204cf308596e0e26f578a6e2da88f49c0f4aad9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/controllers')
-rw-r--r-- | spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb b/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb index c24418b2f90..8962d98218a 100644 --- a/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb +++ b/spec/support/shared_examples/controllers/uploads_actions_shared_examples.rb @@ -74,7 +74,7 @@ shared_examples 'handle uploads' do end before do - expect(FileUploader).to receive(:generate_secret).and_return(secret) + allow(FileUploader).to receive(:generate_secret).and_return(secret) UploadService.new(model, jpg, uploader_class).execute end @@ -88,6 +88,18 @@ shared_examples 'handle uploads' do end end + context 'when the upload does not have a MIME type that Rails knows' do + let(:po) { fixture_file_upload('spec/fixtures/missing_metadata.po', 'text/plain') } + + it 'falls back to the null type' do + UploadService.new(model, po, uploader_class).execute + + get :show, params: params.merge(secret: secret, filename: 'missing_metadata.po') + + expect(response.headers['Content-Type']).to eq('application/octet-stream') + end + end + context "when the model is public" do before do model.update_attribute(:visibility_level, Gitlab::VisibilityLevel::PUBLIC) |