1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00

Get aliases working

This commit is contained in:
Joshua Clayton 2011-12-16 12:13:59 -05:00
parent 2c04d53635
commit 105e892dd2

View file

@ -42,8 +42,7 @@ module FactoryGirl
end
def attribute_names_to_assign
override_names = @evaluator.__overrides.keys
non_ignored_attribute_names + override_names - ignored_attribute_names
(non_ignored_attribute_names + override_names - ignored_attribute_names - aliases_to_ignore)
end
def non_ignored_attribute_names
@ -57,5 +56,15 @@ module FactoryGirl
def association_names
@attribute_list.select(&:association?).map(&:name)
end
def override_names
@evaluator.__overrides.keys
end
def aliases_to_ignore
@attribute_list.reject(&:ignored).map do |attribute|
override_names.map {|o| attribute.name if attribute.alias_for?(o) && attribute.name != o }
end.flatten.compact
end
end
end