Factory Girl and has_one
If that's the case I would add the association into the other factory:
Factory.define :video do |v|
v.filename {Sham.filename}
v.video_url {Sham.url}
v.audition {|v| v.association(:audition)}
end
Then you can do
v = Factory(:video) # This will now have an audition
a = v.audition # This should not be nil
and
a = Factory(:audition) # An audition without a video, if that's possible?
You can also override any association as needed when you create the factory in your tests, i.e:
v = Factory(:video, :audition => Factory(:audition))
v = Factory(:video, :audition => nil)
Hope what I've said makes sense and is true lol. Let us know how you get on.