add tests for Sinatra::RespondWith#respond_to

This commit is contained in:
Konstantin Haase 2011-03-26 00:16:40 +01:00
parent 18e379f1cf
commit 503250fd67
1 changed files with 21 additions and 0 deletions

View File

@ -241,5 +241,26 @@ describe Sinatra::RespondWith do
end
describe :respond_to do
it 'acts as global provides condition' do
respond_app do
respond_to :json, :html
get('/a') { 'ok' }
get('/b') { 'ok' }
end
req('/b', :xml).should_not be_ok
req('/b', :html).should be_ok
end
it 'still allows provides' do
respond_app do
respond_to :json, :html
get('/a') { 'ok' }
get('/b', :provides => :json) { 'ok' }
end
req('/b', :html).should_not be_ok
req('/b', :json).should be_ok
end
end
end