thoughtbot/factory_girl — Issue #246: Trait callbacks run out of order
Author: ngan
Created: 2011-11-23 21:52:44+00:00
State: open

Ever since upgrading factory_girl 2.3.0, our trait callbacks (after_create) are getting run in the opposite order. For example:

```
trait :first do
after_create do |o|
o.status = "first"
end
end

trait :second do
after_create do |o|
o.status = "second"
end
end

factory :something, :traits => [:first, :second]
```

```
# In 2.2.0 (good)
FactoryGirl.create(:something).status #=> second

# In 2.3.0 (bad)
FactoryGirl.create(:something).status #=> first
```

The attributes seems to be assigning in the proper order. It's just the callbacks that are wrong.