1
0
Fork 0
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:
Joshua Clayton 2012-04-20 16:36:30 -04:00
parent 3768d15322
commit 939554c596

View file

@ -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