Skip to content
This repository was archived by the owner on Apr 17, 2018. It is now read-only.

Conversation

@tillsc
Copy link

@tillsc tillsc commented Oct 11, 2011

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant