# Restful-authentication and unit tests

**URL:** <https://www.ruby-forum.com/t/restful-authentication-and-unit-tests/159742>\
**Category:** Rails\
**Created:** [February 8, 2009, 12:46am UTC](https://www.ruby-forum.com/t/restful-authentication-and-unit-tests/159742 "2009-02-08T00:46:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [February 8, 2009, 12:46am UTC](https://www.ruby-forum.com/t/restful-authentication-and-unit-tests/159742/1 "2009-02-08T00:46:07Z")

</div>

There are two unit tests in restful-authentication that fails for me  
as User.authenticate returns nil

def test\_should\_reset\_password  
users(:quentin).update\_attributes(:password =\>  
‘new\_password’, :password\_confirmation =\> ‘new\_password’)  
assert\_equal users(:quentin), User.authenticate(‘quentin’,  
‘new\_password’)  
end

def test\_should\_not\_rehash\_password  
users(:quentin).update\_attributes(:login =\> ‘quentin2’)  
assert\_equal users(:quentin), User.authenticate(‘quentin2’,  
‘monkey’)  
end

However, should it really be possible just to change password? At  
least in the older version one had to generate at new user, I think.  
That is the test should assert errors instead. The same holds for the  
second test . Should it not assert errors instead of equal ?

Anyone that has had the same problem ?

Any help would be appreciated
