mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 06:14:40 +08:00
update back-end specs
This commit is contained in:
@ -41,20 +41,39 @@ describe UploadsController do
|
||||
let(:files) { [ logo_dev, logo ] }
|
||||
|
||||
context 'with a file' do
|
||||
it 'is succesful' do
|
||||
|
||||
it 'is successful' do
|
||||
xhr :post, :create, file: logo
|
||||
response.should be_success
|
||||
end
|
||||
|
||||
it 'supports only images' do
|
||||
xhr :post, :create, file: text_file
|
||||
response.status.should eq 415
|
||||
context 'when authorized' do
|
||||
|
||||
before { SiteSetting.stubs(:authorized_extensions).returns(".txt") }
|
||||
|
||||
it 'is successful' do
|
||||
xhr :post, :create, file: text_file
|
||||
response.status.should eq 200
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'when not authorized' do
|
||||
|
||||
before { SiteSetting.stubs(:authorized_extensions).returns(".png") }
|
||||
|
||||
it 'rejects the upload' do
|
||||
xhr :post, :create, file: text_file
|
||||
response.status.should eq 415
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'with some files' do
|
||||
|
||||
it 'is succesful' do
|
||||
it 'is successful' do
|
||||
xhr :post, :create, files: files
|
||||
response.should be_success
|
||||
end
|
||||
|
Reference in New Issue
Block a user