Specifying the factory
You can specify a different factory (although Aliases might also help you out here).
Implicitly:
factory :post do
# ...
author factory: :user
end
Explicitly:
factory :post do
# ...
association :author, factory: :user
end
Inline:
factory :post do
# ...
author { association :user }
end