Add spec for custom username validation

This commit is contained in:
Thor77 2019-04-23 10:46:36 +02:00
parent 9c808b9921
commit 3ef3b6985f
1 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,12 @@ RSpec.describe User, type: :model do
it { should have_many :tournaments }
end
describe 'validation' do
subject { create(:user) }
it { should validate_presence_of :username }
it { should validate_uniqueness_of(:username).case_insensitive }
end
it 'has a valid factory' do
expect(build(:user)).to be_valid
end