mirror of
https://github.com/heartcombo/devise.git
synced 2026-04-28 03:00:29 -04:00
Updating sessions controller to use resource oriented style. Changing authenticate method to accept a hash of attributes.
This commit is contained in:
@@ -100,19 +100,19 @@ class AuthenticableTest < ActiveSupport::TestCase
|
||||
test 'should authenticate a valid user with email and password and return it' do
|
||||
user = create_user
|
||||
User.any_instance.stubs(:confirmed?).returns(true)
|
||||
authenticated_user = User.authenticate(user.email, user.password)
|
||||
authenticated_user = User.authenticate(:email => user.email, :password => user.password)
|
||||
assert_equal authenticated_user, user
|
||||
end
|
||||
|
||||
test 'should return nil when authenticating an invalid user by email' do
|
||||
user = create_user
|
||||
authenticated_user = User.authenticate('another.email@email.com', user.password)
|
||||
authenticated_user = User.authenticate(:email => 'another.email@email.com', :password => user.password)
|
||||
assert_nil authenticated_user
|
||||
end
|
||||
|
||||
test 'should return nil when authenticating an invalid user by password' do
|
||||
user = create_user
|
||||
authenticated_user = User.authenticate(user.email, 'another_password')
|
||||
authenticated_user = User.authenticate(:email => user.email, :password => 'another_password')
|
||||
assert_nil authenticated_user
|
||||
end
|
||||
end
|
||||
|
||||
@@ -63,14 +63,14 @@ class ConfirmableTest < ActiveSupport::TestCase
|
||||
|
||||
test 'should not authenticate a user not confirmed' do
|
||||
user = create_user
|
||||
authenticated_user = User.authenticate(user.email, user.password)
|
||||
authenticated_user = User.authenticate(:email => user.email, :password => user.password)
|
||||
assert_nil authenticated_user
|
||||
end
|
||||
|
||||
test 'should authenticate a confirmed user' do
|
||||
user = create_user
|
||||
user.confirm!
|
||||
authenticated_user = User.authenticate(user.email, user.password)
|
||||
authenticated_user = User.authenticate(:email => user.email, :password => user.password)
|
||||
assert_not_nil authenticated_user
|
||||
assert_equal authenticated_user, user
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user