better consistency around email case sensitivity

This commit is contained in:
Régis Hanol
2013-04-15 02:20:33 +02:00
parent c6ab9fec9d
commit b24c1a1ad9
10 changed files with 62 additions and 35 deletions

View File

@ -119,12 +119,12 @@ describe SessionController do
context 'for a non existant username' do
it "doesn't generate a new token for a made up username" do
lambda { xhr :post, :forgot_password, username: 'made_up'}.should_not change(EmailToken, :count)
lambda { xhr :post, :forgot_password, login: 'made_up'}.should_not change(EmailToken, :count)
end
it "doesn't enqueue an email" do
Jobs.expects(:enqueue).with(:user_mail, anything).never
xhr :post, :forgot_password, username: 'made_up'
xhr :post, :forgot_password, login: 'made_up'
end
end
@ -132,12 +132,12 @@ describe SessionController do
let(:user) { Fabricate(:user) }
it "generates a new token for a made up username" do
lambda { xhr :post, :forgot_password, username: user.username}.should change(EmailToken, :count)
lambda { xhr :post, :forgot_password, login: user.username}.should change(EmailToken, :count)
end
it "enqueues an email" do
Jobs.expects(:enqueue).with(:user_email, has_entries(type: :forgot_password, user_id: user.id))
xhr :post, :forgot_password, username: user.username
xhr :post, :forgot_password, login: user.username
end
end