add player rating to the db

This commit is contained in:
2026-10-25 17:10:40 +03:00
parent acdaebd491
commit 765a3365bd
9 changed files with 180 additions and 147 deletions
+13
View File
@@ -40,6 +40,19 @@ RSpec.describe User, type: :model do
end
end
describe "rating" do
it "defaults to the neutral initial value of 100" do
expect(User.create!(valid_attributes).rating).to eq(100)
end
it "requires a rating" do
user = User.new(valid_attributes)
user.rating = nil
expect(user).not_to be_valid
expect(user.errors[:rating]).to be_present
end
end
describe "nickname normalization" do
it "strips surrounding whitespace" do
user = User.create!(valid_attributes.merge(nickname: " player_one "))