Configuring session and password controllers as engine, and getting integration tests from devise example app.

This commit is contained in:
Carlos A. da Silva
2009-10-07 21:46:40 -03:00
parent 0ba9980355
commit 7ce49cbbe8
60 changed files with 27590 additions and 69 deletions

View File

@@ -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

View File

@@ -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