Downcasing emails actually happens with valid data
This commit is contained in:
parent
dd69e9a89b
commit
da37a057cb
1 changed files with 6 additions and 6 deletions
|
@ -9,6 +9,12 @@ describe User, type: :model do
|
||||||
it 'should be valid' do
|
it 'should be valid' do
|
||||||
expect(user).to be_valid
|
expect(user).to be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should downcase emails' do
|
||||||
|
user.email = 'UPPERCASE@BADMAIL.COM'
|
||||||
|
user.save
|
||||||
|
expect(user.email).to eq('uppercase@badmail.com')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with invalid data' do
|
context 'with invalid data' do
|
||||||
|
@ -28,12 +34,6 @@ describe User, type: :model do
|
||||||
expect(user).to be_invalid
|
expect(user).to be_invalid
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should downcase emails' do
|
|
||||||
user.email = 'UPPERCASE@BADMAIL.COM'
|
|
||||||
user.save
|
|
||||||
expect(user.email).to eq('uppercase@badmail.com')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'should not allow duplicate emails' do
|
it 'should not allow duplicate emails' do
|
||||||
original = create(:user)
|
original = create(:user)
|
||||||
duplicate = build(:user, email: original.email)
|
duplicate = build(:user, email: original.email)
|
||||||
|
|
Loading…
Reference in a new issue