FEATURE: support for enabling all upload file types

BUGFIX: authorized extensions is now case insensitive
This commit is contained in:
Régis Hanol
2014-04-29 19:12:35 +02:00
parent 359d59242e
commit 4371374ba6
6 changed files with 70 additions and 23 deletions

View File

@ -28,7 +28,7 @@ describe UploadsController do
let(:text_file) do
ActionDispatch::Http::UploadedFile.new({
filename: 'LICENSE.txt',
filename: 'LICENSE.TXT',
tempfile: File.new("#{Rails.root}/LICENSE.txt")
})
end
@ -39,7 +39,7 @@ describe UploadsController do
context 'when authorized' do
before { SiteSetting.stubs(:authorized_extensions).returns(".png|.txt") }
before { SiteSetting.stubs(:authorized_extensions).returns(".PNG|.txt") }
it 'is successful with an image' do
xhr :post, :create, file: logo
@ -75,6 +75,22 @@ describe UploadsController do
end
context 'when everything is authorized' do
before { SiteSetting.stubs(:authorized_extensions).returns("*") }
it 'is successful with an image' do
xhr :post, :create, file: logo
response.status.should eq 200
end
it 'is successful with an attachment' do
xhr :post, :create, file: text_file
response.status.should eq 200
end
end
end
context 'with some files' do