thoughtbot/factory_girl — pull request #366 by chrisbloom7 (2012-04-30 03:44:27+00:00)
Title: Step definitions generated by factories can create instance variables

Given the FactoryGirl::StepDefinitions.create_instance_variables setting is true
When factory girl step definitions are used
Then each step will instantiate an instance variable based on the name of the factory being created

FactoryGirl steps that accept a table or object count will instantiate their instance variables as an array of factoried objects, while the other steps will result in instance variables that contain only a single factoried object.

This is based off of some 2-year-old code that github user @blaix posted as a Gist. I updated it to work with the latest version of FG, added test coverage, added a config variable to toggle the behavior off, and made it more robust.