Downcasing emails actually happens with valid data

This commit is contained in:
Andrew Tomaka 2015-07-13 01:23:31 -04:00
parent dd69e9a89b
commit da37a057cb

View file

@ -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)