mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-25 12:01:03 +00:00
Return error in JSON for users API
This commit is contained in:
parent
56087b09f3
commit
8717173797
2 changed files with 3 additions and 1 deletions
|
@ -51,7 +51,7 @@ class Api::V1::UsersController < Api::V1::BaseController
|
||||||
private
|
private
|
||||||
|
|
||||||
def not_found
|
def not_found
|
||||||
head :not_found
|
render json: {error: "User not found"}, status: :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
def steam_profile(user)
|
def steam_profile(user)
|
||||||
|
|
|
@ -80,11 +80,13 @@ describe Api::V1::UsersController do
|
||||||
it "returns 404 if user does not exist" do
|
it "returns 404 if user does not exist" do
|
||||||
get :show, id: -1
|
get :show, id: -1
|
||||||
expect(response.status).to eq(404)
|
expect(response.status).to eq(404)
|
||||||
|
expect(json["error"]).to eq("User not found")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns 404 if user does not exist by steamid" do
|
it "returns 404 if user does not exist by steamid" do
|
||||||
get :show, id: -1, format: "steamid"
|
get :show, id: -1, format: "steamid"
|
||||||
expect(response.status).to eq(404)
|
expect(response.status).to eq(404)
|
||||||
|
expect(json["error"]).to eq("User not found")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "queries the steam condenser for an invalid steamid" do
|
it "queries the steam condenser for an invalid steamid" do
|
||||||
|
|
Loading…
Reference in a new issue