mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-27 19:50:56 +00:00
Merge pull request #35 from cblanc/handle_missing_user
Return 404 if user not found
This commit is contained in:
commit
ed3bf229c0
2 changed files with 8 additions and 0 deletions
|
@ -19,5 +19,7 @@ class Api::V1::UsersController < Api::V1::BaseController
|
|||
nickname: @steam.nickname
|
||||
}
|
||||
}
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
raise ActionController::RoutingError.new('User Not Found')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,6 +23,12 @@ describe Api::V1::UsersController do
|
|||
expect(json['steam']).to have_key("url")
|
||||
expect(json['steam']).to have_key("nickname")
|
||||
end
|
||||
|
||||
it 'returns 404 if user does not exist' do
|
||||
expect {
|
||||
get :show, id: -1
|
||||
}.to raise_error(ActionController::RoutingError)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#index' do
|
||||
|
|
Loading…
Reference in a new issue