FactoryGirl で relation 定義したいんだけど、具体的には 1 2 3 4 5 6 7 class User < ActiveRecord::Base has_many :tasks end class Task < ActiveRecord::Base belongs_to :user validates :user, :presence => true end こんな 2 つのモデルで users.rb 1 2 3 4 5 6 7 8 9 FactoryGirl.define do factory :user do tasks do [ FactoryGirl.create(:task) , ] end end end tasks.rb 1 2 3 4 5 FactoryGirl.define do factory :task do user end end みたいな