ianwhite/pickle — Issue #37: Regular expression too big
Author: ppgengler
Created: 2012-02-01 21:15:04+00:00
State: open

I noticed that the lighthouse issues seem to have been abandoned in favor of the GitHub issues so I thought I'd open one for this:
http://ianwhite.lighthouseapp.com/projects/25941/tickets/35-regular-expression-too-big

The short of it is that the method for matching models requires a regular expression that is proportional to the number of factories defined, which causes issues as projects have more factories (usually through having more models).

Aside from the ideas in that thread I also recently discovered that factory girl has built in cucumber steps that do a subset of what pickle does: https://github.com/thoughtbot/factory_girl/blob/master/lib/factory_girl/step_definitions.rb. It however accomplishes it by making N steps for N factories rather than 1 step with a RegExp that has N proportional components. This seems like it will scale significantly better at fairly small cost. However, the factory_girl code doesn't allow for as rich of a DSL as pickle. If one could combine the richer matching in capture_model but instead add that ona per factory base like they do, it seems like they could have the best of both worlds. In order to retain true factory independence there'd need to be some helper that fulfills the role of capture_model, but does so via the factory iterator method, rather than a large RegExp.

Thanks,
\Peter