Permalink
Browse files

Test email is downcased before saving

  • Loading branch information...
dskecse committed Mar 4, 2014
1 parent 6bfffb0 commit aa5475e3c38949c6d36b1954481c565f91b7e45a
Showing with 10 additions and 0 deletions.
  1. +10 −0 spec/models/user_spec.rb
View
@@ -62,6 +62,16 @@
it { should_not be_valid }
end
+ context 'email address with mixed case' do
+ let(:mixed_case_email) { 'Foo@ExAMPle.CoM' }
+
+ it 'is saved as all lower-case' do
+ @user.email = mixed_case_email
+ @user.save
+ expect(@user.reload.email).to eq mixed_case_email.downcase
+ end
+ end
+
context 'when password is not present' do
before { @user.password = @user.password_confirmation = ' ' }
it { should_not be_valid }

0 comments on commit aa5475e

Please sign in to comment.