Skip to content

Commit 0261ab8

Browse files
wagenetnamusyaka
authored andcommitted
Failing test case catch-all route - #1081
1 parent 813925e commit 0261ab8

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
@@ -508,6 +508,37 @@ class DummyFormatClass
508508
end
509509
end
510510

511+
it 'allows for catch-all in a namespace' do
512+
subject.namespace :nested do
513+
get do
514+
'root'
515+
end
516+
517+
get 'something' do
518+
'something'
519+
end
520+
521+
route :any, '*path' do
522+
'catch-all'
523+
end
524+
end
525+
526+
send('get', 'nested')
527+
expect(last_response.body).to eql 'root'
528+
529+
send('get', 'nested/something')
530+
expect(last_response.body).to eql 'something'
531+
532+
send('get', 'nested/missing')
533+
expect(last_response.body).to eql 'catch-all'
534+
535+
send('post', 'nested')
536+
expect(last_response.body).to eql 'catch-all'
537+
538+
send('post', 'nested/something')
539+
expect(last_response.body).to eql 'catch-all'
540+
end
541+
511542
verbs = %w(post get head delete put options patch)
512543
verbs.each do |verb|
513544
it "allows and properly constrain a #{verb.upcase} method" do

0 commit comments

Comments
 (0)