mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
Use Hash#fetch
This commit is contained in:
parent
3768d15322
commit
939554c596
1 changed files with 2 additions and 6 deletions
|
@ -28,13 +28,9 @@ module FactoryGirl
|
|||
end
|
||||
|
||||
def association(factory_name, overrides = {})
|
||||
build_strategy = if overrides.has_key?(:strategy)
|
||||
overrides[:strategy]
|
||||
else
|
||||
Strategy::Create
|
||||
end
|
||||
strategy_override = overrides.fetch(:strategy) { Strategy::Create }
|
||||
|
||||
build_strategy = StrategyCalculator.new(build_strategy).strategy
|
||||
build_strategy = StrategyCalculator.new(strategy_override).strategy
|
||||
runner = FactoryRunner.new(factory_name, build_strategy, [overrides.except(:strategy)])
|
||||
@build_strategy.association(runner)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue