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############
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue