From 75ef1a67c67f2dabd607948efaf4210baedd33c2 Mon Sep 17 00:00:00 2001 From: Peter Wagenet Date: Tue, 4 Aug 2015 11:28:43 -0700 Subject: [PATCH] Failing test case catch-all route - #1081 --- spec/grape/api_spec.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/spec/grape/api_spec.rb b/spec/grape/api_spec.rb index 34ae001a9a..3314d1841f 100644 --- a/spec/grape/api_spec.rb +++ b/spec/grape/api_spec.rb @@ -480,6 +480,37 @@ def subject.enable_root_route! end end + it 'allows for catch-all in a namespace' do + subject.namespace :nested do + get do + 'root' + end + + get 'something' do + 'something' + end + + route :any, '*path' do + 'catch-all' + end + end + + send('get', 'nested') + expect(last_response.body).to eql 'root' + + send('get', 'nested/something') + expect(last_response.body).to eql 'something' + + send('get', 'nested/missing') + expect(last_response.body).to eql 'catch-all' + + send('post', 'nested') + expect(last_response.body).to eql 'catch-all' + + send('post', 'nested/something') + expect(last_response.body).to eql 'catch-all' + end + verbs = %w(post get head delete put options patch) verbs.each do |verb| it 'allows and properly constrain a #{verb.upcase} method' do