1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/test/controllers/passwords_controller_test.rb
Andri Möll 052cbef205 Don't confirm email after password reset.
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2013-08-18 10:13:35 +02:00

31 lines
986 B
Ruby

require 'test_helper'
class PasswordsControllerTest < ActionController::TestCase
tests Devise::PasswordsController
include Devise::TestHelpers
setup do
request.env["devise.mapping"] = Devise.mappings[:user]
@user = create_user.tap(&:confirm!)
@raw = @user.send_reset_password_instructions
end
def put_update_with_params
put :update, "user" => {
"reset_password_token" => @raw, "password" => "123456", "password_confirmation" => "123456"
}
end
test 'redirect to after_sign_in_path_for if after_resetting_password_path_for is not overridden' do
put_update_with_params
assert_redirected_to "http://test.host/"
end
test 'redirect accordingly if after_resetting_password_path_for is overridden' do
custom_path = "http://custom.path/"
Devise::PasswordsController.any_instance.stubs(:after_resetting_password_path_for).with(@user).returns(custom_path)
put_update_with_params
assert_redirected_to custom_path
end
end