Separating perishable token into confirmation and reset_password tokens. Adding confirmation_sent_at attribute.

This commit is contained in:
Carlos A. da Silva
2009-10-18 09:14:52 -02:00
parent bc825d3b23
commit 75e98d3041
19 changed files with 210 additions and 200 deletions

View File

@@ -36,7 +36,7 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
test 'body should have link to confirm the account' do
host = ActionMailer::Base.default_url_options[:host]
confirmation_url_regexp = %r{<a href=\"http://#{host}/users/confirmation\?perishable_token=#{@user.perishable_token}">}
confirmation_url_regexp = %r{<a href=\"http://#{host}/users/confirmation\?confirmation_token=#{@user.confirmation_token}">}
assert_match confirmation_url_regexp, @mail.body
end
end

View File

@@ -7,7 +7,8 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
I18n.backend.store_translations :en, {:devise => { :notifier => { :reset_password_instructions => 'Reset instructions' } }}
Notifier.sender = 'test@example.com'
@user = create_user
@mail = Notifier.deliver_reset_password_instructions(@user)
@user.send_reset_password_instructions
@mail = ActionMailer::Base.deliveries.last
end
test 'email sent after reseting the user password' do
@@ -36,7 +37,7 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
test 'body should have link to confirm the account' do
host = ActionMailer::Base.default_url_options[:host]
confirmation_url_regexp = %r{<a href=\"http://#{host}/users/password/edit\?perishable_token=#{@user.perishable_token}">}
confirmation_url_regexp = %r{<a href=\"http://#{host}/users/password/edit\?reset_password_token=#{@user.reset_password_token}">}
assert_match confirmation_url_regexp, @mail.body
end
end