Posts Tagged: versions

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 »

Version Callbacks for ToSBack Policies

Our ToSBack policies now have some automatic versioning when the “detail” attribute is changed! Here’s an example policy in my development environment. Its current version is stored as an attribute in the policy model (detail), but it’s also represented in the versions model: 1.9.3-p327 :001 > pol = Policy.first 1.9.3-p327 :009 > pol.detail => "… Read more »