datamapper/dm-sweatshop — pull request #9 by tillsc (2011-10-11 15:42:47+00:00)
Title: Added factory inheritance

Added support for hash key :super to add inheritance of factories.

Use the key `:super` with value `nil` or with a fixture name to inherit from the fixture of the superclass.

E.g. (`Duck < Animal`)

Animal.fix {{
:alive => true
}}

Duck.fix {{
:super => nil,
:legs => 2
}}

If you've got a named fixture you can use the name instead of nil (which defaults to the name of the current factory)

Animal.fix(:dead) {{
:alive => false
}}

Duck.fix(:fried) {{
:super => :dead
}}

In the last case `:super => nil` won't work due to the fact that there is no Animal fixture with name `:fired