RS, DG; User.instatntiate simplified

This commit is contained in:
Raphael 2010-08-10 15:44:14 -07:00
parent a8b77cf868
commit 8b9cd3453d
2 changed files with 6 additions and 11 deletions

View file

@ -119,15 +119,8 @@ class User
###Helpers############
def self.instantiate( opts = {} )
User.create(
:email => opts[:email],
:password => opts[:password],
:password_confirmation => opts[:password_confirmation],
:person => Person.new(
:email => opts[:email],
:profile => Profile.new(
:first_name => opts[:first_name],
:last_name => opts[:last_name])))
opts[:person][:email] = opts[:email]
User.create( opts)
end
def terse_url

View file

@ -15,8 +15,10 @@ describe User do
user = User.instantiate(:email => "bob@bob.com",
:password => "password",
:password_confirmation => "password",
:person =>
{:profile => {
:first_name => "bob",
:last_name => "grimm")
:last_name => "grimm"}})
user.save.should be true
user.person.should_not be nil