Skip to content

Commit

Permalink
use Class.new to avoid override the User class
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Dec 26, 2014
1 parent 7f542aa commit acef54b
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions spec/grape/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2417,35 +2417,32 @@ def static
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
app = Class.new(Grape::API)
app.version 'v1'
app.resources :users do
get :hello do
'hello users'
end
end
subject.mount User
subject.mount app

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

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

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

end
end

Expand Down

0 comments on commit acef54b

Please sign in to comment.