1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
thoughtbot--factory_bot/spec
Joshua Clayton 779eafccbd Fix various trait bugs so traits can be used within each other
The previous implementation of trait handling within the Definition
didn't account for when implicit traits were used within other traits.
This is useful if you have two different traits, but one depends on
another; for example, a refunded order and a completed order could both
have the attribute `completed_at` set, but refunded would additionally
have `refunded_at` set:

    FactoryGirl.define do
      factory :order do
        trait :completed do
          completed_at { 3.days.ago }
        end

        trait :refunded do
          completed
          refunded_at { 1.day.ago }
        end
      end
    end

This also tests to make sure that callbacks, custom constructors, and
creation overrides work correctly when implicit traits are used within
other traits.

Fixes #360
2012-06-15 20:08:42 -04:00
..
acceptance Fix various trait bugs so traits can be used within each other 2012-06-15 20:08:42 -04:00
factory_girl Fix various trait bugs so traits can be used within each other 2012-06-15 20:08:42 -04:00
support Move strategy calculation to Factory#run 2012-05-04 13:36:46 -04:00
factory_girl_spec.rb Clean up attribute and core factory specs 2011-08-19 17:21:14 -04:00
spec_helper.rb Clean up SimpleCov usage 2012-04-23 21:50:39 -05:00