mirror of
https://github.com/thoughtbot/factory_bot.git
synced 2022-11-09 11:43:51 -05:00
Fix #aggregate_from_traits_and_self's complexity
This commit is contained in:
parent
2fa1bf876b
commit
ec491192e5
1 changed files with 5 additions and 10 deletions
|
@ -125,17 +125,12 @@ module FactoryGirl
|
|||
|
||||
def aggregate_from_traits_and_self(method_name, &block)
|
||||
compile
|
||||
[].tap do |list|
|
||||
base_traits.each do |trait|
|
||||
list << trait.send(method_name)
|
||||
end
|
||||
|
||||
list << instance_exec(&block)
|
||||
|
||||
additional_traits.each do |trait|
|
||||
list << trait.send(method_name)
|
||||
end
|
||||
end.flatten.compact
|
||||
[
|
||||
base_traits.map(&method_name),
|
||||
instance_exec(&block),
|
||||
additional_traits.map(&method_name),
|
||||
].flatten.compact
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue