From 77b707daab84801b3ea54748a50a56b5e90a00e8 Mon Sep 17 00:00:00 2001 From: Horacio Branciforte Date: Sat, 26 Oct 2019 09:56:47 +0200 Subject: [PATCH] Add test where pre filter cannot modify params on certain cases --- test/filter_test.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/filter_test.rb b/test/filter_test.rb index f708015b..10ad31ed 100644 --- a/test/filter_test.rb +++ b/test/filter_test.rb @@ -409,6 +409,27 @@ class AfterFilterTest < Minitest::Test assert_body 'bar' 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 mock_app do before { params.delete('foo') }