1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

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

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