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/ 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 => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire', :address => 'myaddress' }.merge(options)) end
4) 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.