RS, DG; User.instatntiate simplified
This commit is contained in:
parent
a8b77cf868
commit
8b9cd3453d
2 changed files with 6 additions and 11 deletions
|
|
@ -119,15 +119,8 @@ class User
|
||||||
|
|
||||||
###Helpers############
|
###Helpers############
|
||||||
def self.instantiate( opts = {} )
|
def self.instantiate( opts = {} )
|
||||||
User.create(
|
opts[:person][:email] = opts[:email]
|
||||||
:email => opts[:email],
|
User.create( opts)
|
||||||
: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])))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def terse_url
|
def terse_url
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,10 @@ describe User do
|
||||||
user = User.instantiate(:email => "bob@bob.com",
|
user = User.instantiate(:email => "bob@bob.com",
|
||||||
:password => "password",
|
:password => "password",
|
||||||
:password_confirmation => "password",
|
:password_confirmation => "password",
|
||||||
|
:person =>
|
||||||
|
{:profile => {
|
||||||
:first_name => "bob",
|
:first_name => "bob",
|
||||||
:last_name => "grimm")
|
:last_name => "grimm"}})
|
||||||
|
|
||||||
user.save.should be true
|
user.save.should be true
|
||||||
user.person.should_not be nil
|
user.person.should_not be nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue