add player rating to the db
This commit is contained in:
@@ -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 "))
|
||||
|
||||
Reference in New Issue
Block a user