Add new user API spec

This commit is contained in:
Prommah 2015-11-03 07:50:14 +00:00
parent ddb6467573
commit 429939cf6a

View file

@ -78,9 +78,23 @@ describe Api::V1::UsersController do
end end
it "returns 404 if user does not exist" do it "returns 404 if user does not exist" do
expect { expect { get :show, id: -1 }.to raise_error(ActionController::RoutingError)
get :show, id: -1 end
}.to raise_error(ActionController::RoutingError)
it "returns 404 if user does not exist by steamid" do
expect { get :show, id: -1, format: "steamid" }.to raise_error(ActionController::RoutingError)
end
it "queries the steam condenser for an invalid steamid" do
@user.update_attribute(:steamid, "0:0:0")
get :show, id: @user.id
expect(response).to be_success
expect(json["steam"]).to_not be_nil
expect(json["steam"]["id"]).to eq(@user.steamid)
expect(json["steam"]["url"]).to be_nil
expect(json["steam"]["nickname"]).to be_nil
end end
it "returns correct ban if user muted" do it "returns correct ban if user muted" do