update back-end specs

This commit is contained in:
Régis Hanol
2013-07-10 22:59:07 +02:00
parent 6beb12e778
commit b94d26d798
7 changed files with 73 additions and 13 deletions

View File

@ -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