Posts Tagged: factorygirl

Adding Dynamic Versions to the Policy Factory

FactoryGirl provides a lot of flexibility when it comes to creating associations, so following their example, TOSBack is using an after(:create) callback to produce some content in the tests that appears to be changing over time: factory :policy_with_sites_and_versions do ignore do sites_count 5 versions_count 5 end after(:create) do |policy, eval| eval.sites_count.times { policy.sites << FactoryGirl.create(:site)… Read more »