Topic: factory girl association problems
I'm just learning factory girl and I'm implementing it into an old project.
It seems that when I do a association for a user it creates a new record even though I'm telling the association to point to a factory I've already created.
# Users Factory.define :user do |u| u.username 'John' u.password 'password' u.firstname 'John' u.lastname 'Smith' end Factory.define :admin, :parent => :user do |u| u.username 'admin' u.superuser true end Factory.define :car do |f| f.make 'Nissan' f.model 'Skyline' f.assocation :user, :factory => :admin end
Is this normal behaviour for an assocation?
Is there a way to link to an existing user instead of creating a new user?