Merge branch 'atomaka/refactor/downcase-test-fix' into 'master'

Slight organization cleanup in users tests

Downcasing of the email address actually happens with valid data.

See merge request !7
This commit is contained in:
Andrew Tomaka 2015-07-13 14:57:07 -04:00
commit 527dc493c6

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)