Added id to users API index method

This commit is contained in:
Chris Blanchard 2015-08-17 18:55:03 +01:00
parent 01d0a5d80a
commit e6f05374d3
2 changed files with 4 additions and 2 deletions

View file

@ -29,7 +29,8 @@ class Api::V1::UsersCollection < Api::V1::Collection
users_table[:steamid],
teams_table[:name],
teams_table[:tag],
teams_table[:logo]
teams_table[:logo],
users_table[:id]
]
end
@ -45,6 +46,7 @@ class Api::V1::UsersCollection < Api::V1::Collection
def map_query
execute_query.map do |row|
{
id: row[5],
username: row[0],
steamid: row[1],
team: {

View file

@ -81,11 +81,11 @@ describe Api::V1::UsersController do
it 'returns the excpected JSON keys' do
get :index
user_json = json["users"].first
nested_team_json = user_json["team"]
expect(user_json).to have_key("username")
expect(user_json).to have_key("id")
expect(user_json).to have_key("steamid")
expect(user_json).to have_key("team")
expect(nested_team_json).to have_key("name")