I was originally using after(:build) to create a different instance of a model that is needed but is not actually associated with the factory being created. The problem with this is it seems to create a database object that is not deleted by my transaction database cleaner.
Ex:
factory :order do
factory :particular_order do
after(:build) do |order, evaluator|
create(:product, name: "Fake Product")
end
end
end
Running build(:particular_order) in my tests will create product in my database and not allow the cleaner to remove it after the test is done, tho the database cleaner works on everything else i use that doesn't have after(:build) calls.
I am trying to avoid having to use truncation to clean the database after just these runs.
I've tried A LOT to get this working.
Any ideas?