1
0
Fork 0
mirror of https://github.com/thoughtbot/factory_bot.git synced 2022-11-09 11:43:51 -05:00
This commit is contained in:
Joshua Clayton 2011-08-12 14:49:21 -04:00
parent 82746c2ae0
commit a3e20d5ff7
2 changed files with 5 additions and 3 deletions

View file

@ -1,7 +1,7 @@
module FactoryGirl
class Attribute
class Attribute #:nodoc:
class AttributeGroup < Attribute
class AttributeGroup < Attribute #:nodoc:
def initialize(name, factory)
super(name)
@factory = factory
@ -17,5 +17,6 @@ module FactoryGirl
(@factory || FactoryGirl).attribute_group_by_name(name)
end
end
end
end

View file

@ -7,6 +7,7 @@ module FactoryGirl
end
attr_reader :child_factories
def initialize(factory)
@factory = factory
@child_factories = []
@ -153,7 +154,7 @@ module FactoryGirl
def factory(name, options = {}, &block)
@child_factories << [name, options, block]
end
def attribute_group(name, &block)
@factory.define_attribute_group(AttributeGroup.new(name, &block))
end