# File lib/factory_girl/factory.rb, line 54 def associations attributes.select {|attribute| attribute.association? } end
# File lib/factory_girl/factory.rb, line 87 def compile parent.defined_traits.each {|trait| define_trait(trait) } parent.compile @definition.compile end
# File lib/factory_girl/factory.rb, line 23 def factory_name $stderr.puts "DEPRECATION WARNING: factory.factory_name is deprecated; use factory.name instead." name end
# File lib/factory_girl/factory.rb, line 50 def human_names names.map {|name| name.to_s.humanize.downcase } end
Names for this factory, including aliases.
Example:
factory :user, :aliases => [:author] do # ... end FactoryGirl.create(:author).class # => User
Because an attribute defined without a value or block will build an association with the same name, this allows associations to be defined without factories, such as:
factory :user, :aliases => [:author] do # ... end factory :post do author end FactoryGirl.create(:post).author.class # => User
# File lib/factory_girl/factory.rb, line 83 def names [name] + @aliases end
# File lib/factory_girl/factory.rb, line 105 def attributes compile AttributeList.new(@name).tap do |list| traits.each do |trait| list.apply_attributes(trait.attributes) end list.apply_attributes(@definition.attributes) list.apply_attributes(parent.attributes) end end
Generated with the Darkfish Rdoc Generator 2.