1
0
Fork 0
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:
Waldyr 2016-04-02 16:42:40 -03:00 committed by Joshua Clayton
parent 2fa1bf876b
commit ec491192e5
No known key found for this signature in database
GPG key ID: 5B6558F77E9A8118

View file

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