mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
36cb43e9b0
This allows callbacks (after :build, :create, etc.) to be defined at the FactoryGirl level; this means that the callback will be invoked for all factories. This is primarily to maintain consistency and follow the principle of least surprise. As usual, callbacks are applied from the lowest component to the highest, meaning that global callbacks will be run after factory and trait callbacks are run. FactoryGirl.define do after(:build) {|object| puts "Built #{object}" } factory :user # ... end Closes #481 Closes #486 |
||
---|---|---|
.. | ||
activesupport_instrumentation_spec.rb | ||
aliases_spec.rb | ||
attribute_aliases_spec.rb | ||
attribute_existing_on_object_spec.rb | ||
attributes_for_spec.rb | ||
attributes_from_instance_spec.rb | ||
attributes_ordered_spec.rb | ||
build_list_spec.rb | ||
build_spec.rb | ||
build_stubbed_spec.rb | ||
callbacks_spec.rb | ||
create_list_spec.rb | ||
create_spec.rb | ||
define_child_before_parent_spec.rb | ||
definition_spec.rb | ||
definition_without_block_spec.rb | ||
global_initialize_with_spec.rb | ||
global_to_create_spec.rb | ||
initialize_with_spec.rb | ||
keyed_by_class_spec.rb | ||
modify_factories_spec.rb | ||
modify_inherited_spec.rb | ||
nested_attributes_spec.rb | ||
overrides_spec.rb | ||
parent_spec.rb | ||
register_strategies_spec.rb | ||
sequence_context_spec.rb | ||
sequence_spec.rb | ||
skip_create_spec.rb | ||
stub_spec.rb | ||
syntax_methods_within_dynamic_attributes_spec.rb | ||
traits_spec.rb | ||
transient_attributes_spec.rb |