mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Configuring session and password controllers as engine, and getting integration tests from devise example app.
This commit is contained in:
@@ -104,7 +104,8 @@ class AuthenticableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'should authenticate a valid user with email and password and return it' do
|
||||
user = create_user
|
||||
user = User.create!(valid_attributes)
|
||||
User.any_instance.stubs(:confirmed?).returns(true)
|
||||
authenticated_user = User.authenticate(user.email, user.password)
|
||||
assert_equal authenticated_user, user
|
||||
end
|
||||
|
||||
@@ -9,18 +9,18 @@ class RecoverableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test 'should reset password and password confirmation from params' do
|
||||
@user.reset_password('56789', '98765')
|
||||
assert_equal '56789', @user.password
|
||||
assert_equal '98765', @user.password_confirmation
|
||||
@user.reset_password('123456789', '987654321')
|
||||
assert_equal '123456789', @user.password
|
||||
assert_equal '987654321', @user.password_confirmation
|
||||
end
|
||||
|
||||
test 'should reset password and save the record' do
|
||||
assert @user.reset_password!('56789', '56789')
|
||||
assert @user.reset_password!('123456789', '123456789')
|
||||
end
|
||||
|
||||
test 'should not reset password with invalid data' do
|
||||
@user.stubs(:valid?).returns(false)
|
||||
assert_not @user.reset_password!('56789', '98765')
|
||||
assert_not @user.reset_password!('123456789', '987654321')
|
||||
end
|
||||
|
||||
test 'should reset perishable token and send instructions by email' do
|
||||
@@ -87,4 +87,3 @@ class RecoverableTest < ActiveSupport::TestCase
|
||||
assert @user.valid_password?('new_password')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user