mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
add specs for manipulating params in a before filter, fixes #367
This commit is contained in:
parent
32814f8d6f
commit
1ef2e5f84d
1 changed files with 20 additions and 0 deletions
|
@ -380,6 +380,26 @@ class AfterFilterTest < Test::Unit::TestCase
|
|||
assert ran
|
||||
end
|
||||
|
||||
it 'can add params' do
|
||||
mock_app do
|
||||
before { params['foo'] = 'bar' }
|
||||
get('/') { params['foo'] }
|
||||
end
|
||||
|
||||
get '/'
|
||||
assert_body 'bar'
|
||||
end
|
||||
|
||||
it 'can remove params' do
|
||||
mock_app do
|
||||
before { params.delete('foo') }
|
||||
get('/') { params['foo'].to_s }
|
||||
end
|
||||
|
||||
get '/?foo=bar'
|
||||
assert_body ''
|
||||
end
|
||||
|
||||
it 'is possible to apply user_agent conditions to after filters with no path' do
|
||||
ran = false
|
||||
mock_app do
|
||||
|
|
Loading…
Add table
Reference in a new issue