Add spec for custom username validation
This commit is contained in:
parent
9c808b9921
commit
3ef3b6985f
|
|
@ -7,6 +7,12 @@ RSpec.describe User, type: :model do
|
||||||
it { should have_many :tournaments }
|
it { should have_many :tournaments }
|
||||||
end
|
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
|
it 'has a valid factory' do
|
||||||
expect(build(:user)).to be_valid
|
expect(build(:user)).to be_valid
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue