Skip to content

Commit

Permalink
Failing test case catch-all route - #1081
Browse files Browse the repository at this point in the history
  • Loading branch information
wagenet committed Aug 4, 2015
1 parent 0dfc1cc commit 75ef1a6
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions spec/grape/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 75ef1a6

Please sign in to comment.