Skip to content

Commit f96db1c

Browse files
committed
Failing test case catch-all route - #1081
1 parent 52fadb7 commit f96db1c

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

spec/grape/api_spec.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,37 @@ def subject.enable_root_route!
480480
end
481481
end
482482

483+
it 'allows for catch-all in a namespace' do
484+
subject.namespace :nested do
485+
get do
486+
'root'
487+
end
488+
489+
get 'something' do
490+
'something'
491+
end
492+
493+
route :any, '*path' do
494+
'catch-all'
495+
end
496+
end
497+
498+
send('get', 'nested')
499+
expect(last_response.body).to eql 'root'
500+
501+
send('get', 'nested/something')
502+
expect(last_response.body).to eql 'something'
503+
504+
send('get', 'nested/missing')
505+
expect(last_response.body).to eql 'catch-all'
506+
507+
send('post', 'nested')
508+
expect(last_response.body).to eql 'catch-all'
509+
510+
send('post', 'nested/something')
511+
expect(last_response.body).to eql 'catch-all'
512+
end
513+
483514
verbs = %w(post get head delete put options patch)
484515
verbs.each do |verb|
485516
it 'allows and properly constrain a #{verb.upcase} method' do

0 commit comments

Comments
 (0)