Adding a new strategy

19 views
Skip to first unread message

alzeih

unread,
Mar 25, 2012, 5:36:02 PM3/25/12
to factor...@googlegroups.com
I'm looking for a way to add something like:

FactoryGirl.new_strategy(:​thing)

which then manipulates the returned data in a way suitable for another form (in my case, for an api).
Up until now I have been using a helper method in my tests to modify the attributes before I pass them onto the requests, but I'm wondering if there is a better way to do this with my own strategy.

Is there a way to create a new strategy and have it available wherever other strategies are available without forking the code?

Or is there a better way to do this that uses the existing strategies? I don't want to have to define anything on each factory unless I have to override how it is returned in a special case.

Josh Clayton

unread,
Mar 25, 2012, 5:51:28 PM3/25/12
to factory_girl
There's not currently a way to do this, but it's on the list of things
to add sometime in version 3.
Reply all
Reply to author
Forward
0 new messages