diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 69af4ba..161772b 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -15,6 +15,7 @@ class Api::V1::UsersController < Api::V1::BaseController avatar: @user.profile.avatar.url, admin: @user.admin?, steam: { + id: @user.steamid, url: @steam.nil? ? nil : @steam.base_url, nickname: @steam.nil? ? nil : @steam.nickname }, diff --git a/spec/controllers/api/v1/users_controller_spec.rb b/spec/controllers/api/v1/users_controller_spec.rb index 2701f7a..f9e362b 100644 --- a/spec/controllers/api/v1/users_controller_spec.rb +++ b/spec/controllers/api/v1/users_controller_spec.rb @@ -20,6 +20,7 @@ describe Api::V1::UsersController do expect(json["time_zone"]).to eq(@user.time_zone) expect(json["admin"]).to eq(@user.admin?) expect(json).to have_key("steam") + expect(json["steam"]).to have_key("id") expect(json["steam"]).to have_key("url") expect(json["steam"]).to have_key("nickname") expect(json["bans"]["mute"]).to eq(false) @@ -35,6 +36,7 @@ describe Api::V1::UsersController do get :show, id: @user.id expect(response).to be_success + expect(json["steam"]["id"]).to_not be_nil expect(json["steam"]["url"]).to be_nil expect(json["steam"]["nickname"]).to be_nil end