Skip to content

Commit

Permalink
Fix #866: Route not found
Browse files Browse the repository at this point in the history
If we mount a Grape::API app which using version and namespaces to another
Grape::API app, the version setting will lost.
  • Loading branch information
yesmeck committed Dec 26, 2014
1 parent c2fd21f commit 03b75c8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/grape/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ def reset_routes!
def mount_in(route_set)
if endpoints
endpoints.each do |e|
e.inheritable_setting.inherit_from inheritable_setting
e.mount_in(route_set)
end
else
Expand Down
15 changes: 15 additions & 0 deletions spec/grape/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2415,6 +2415,21 @@ def static
options '/v1/apples/colour'
expect(last_response.status).to eql 204
end

it 'mounts a versioned API with nested resources' do
class User < Grape::API
version 'v1'
resources :users do
get :hello do
'hello users'
end
end
end
subject.mount User

get '/v1/users/hello'
expect(last_response.body).to eq('hello users')
end
end
end

Expand Down

0 comments on commit 03b75c8

Please sign in to comment.