mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
Add test where pre filter cannot modify params on certain cases
This commit is contained in:
parent
192bc9b943
commit
77b707daab
1 changed files with 21 additions and 0 deletions
|
@ -409,6 +409,27 @@ class AfterFilterTest < Minitest::Test
|
||||||
assert_body 'bar'
|
assert_body 'bar'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'can add params on a single path' do
|
||||||
|
mock_app do
|
||||||
|
before('/hi'){ params['foo'] = 'bar' }
|
||||||
|
get('/hi') { params['foo'] }
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/hi'
|
||||||
|
assert_body 'bar'
|
||||||
|
end
|
||||||
|
|
||||||
|
# ref: issue #1567
|
||||||
|
it 'can add params on named parameters path' do
|
||||||
|
mock_app do
|
||||||
|
before('/:id/hi'){ params['foo'] = 'bar' }
|
||||||
|
get('/:id/hi') { params['foo'] }
|
||||||
|
end
|
||||||
|
|
||||||
|
get '/:id/hi'
|
||||||
|
assert_body 'bar'
|
||||||
|
end
|
||||||
|
|
||||||
it 'can remove params' do
|
it 'can remove params' do
|
||||||
mock_app do
|
mock_app do
|
||||||
before { params.delete('foo') }
|
before { params.delete('foo') }
|
||||||
|
|
Loading…
Add table
Reference in a new issue