# Restful Authentication Test Problem

**URL:** <https://www.ruby-forum.com/t/restful-authentication-test-problem/126317>\
**Category:** Rails\
**Created:** [January 17, 2008, 12:15pm UTC](https://www.ruby-forum.com/t/restful-authentication-test-problem/126317 "2008-01-17T12:15:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nuwan\_Chaturanga](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9de0a6/32.png) [@Nuwan\_Chaturanga](https://www.ruby-forum.com/u/Nuwan_Chaturanga)\
**Post date:** [January 17, 2008, 12:15pm UTC](https://www.ruby-forum.com/t/restful-authentication-test-problem/126317/1 "2008-01-17T12:15:49Z")

</div>

I am reletively a newbie to Rails. I utilized Restful Authentication  
plugin from techno-weenie for a new application I am developing.  
([http://svn.techno-weenie.net/projects/plugins/](http://svn.techno-weenie.net/projects/plugins/)  
restful\_authentication/)  
I wanted my application to be test driven (TTD). All went smoothly  
until I added a validates\_presence\_of validation to a new model  
attribute (address) I introduced to the User model and then try to run  
the test. The test failed claming the new attribute I supplied was  
nil.

Here what I did:

1. Added a new field (address) to the users table using a migration.
2. Included a validates\_presence\_of :address to the User model.
3. changed the user\_test accordingly.

def create\_user(options = {})  
User.create({:login =\> ‘quire’, :email =\>  
‘removed\_email\_address@domain.invalid’, :password =\> ‘quire’, :password\_confirmation =\>  
‘quire’, :address =\> ‘myaddress’ }.merge(options))  
end

1. run the unit test by rake test:units

The test failed and it seems the value for the address field didn’t  
get saved in the test database.

I tried recreating the test database with rake db:test:clone, rake  
db:test:clone\_structure but failed again.

I use SQLite3 as the database.

Please help me to overcome this issue.

Thank you.
