Skip to content

Commit

Permalink
Fixed version and preifx being overridden when mounting API.
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck authored and dblock committed Dec 28, 2014
1 parent c2fd21f commit 0c0e85f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Next Release
============

* [#868](https://github.com/intridea/grape/pull/868): Fixed `version` and `preifx` being overridden when mounting API - [@yesmeck](https://github.com/yesmeck).
* Your contribution here.

0.10.0 (12/19/2014)
Expand Down
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
30 changes: 30 additions & 0 deletions spec/grape/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2415,6 +2415,36 @@ def static
options '/v1/apples/colour'
expect(last_response.status).to eql 204
end

it 'mounts a versioned API with nested resources' do
api = Class.new(Grape::API) do
version 'v1'
resources :users do
get :hello do
'hello users'
end
end
end
subject.mount api

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

it 'mounts a prefixed API with nested resources' do
api = Class.new(Grape::API) do
prefix 'api'
resources :users do
get :hello do
'hello users'
end
end
end
subject.mount api

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

Expand Down

0 comments on commit 0c0e85f

Please sign in to comment.