I'm running a fairly large web application , and I use Rails/RSpec/
Cucumber/Pickle/FactoryGirl to drive a lot of my testing. We recently
upgraded to Rails 2.3.5, and are now seeing the following error:
regular expression too big: (lots of models) ...(RegexpError)
The error is thrown before any of the Cucumber tests are run, during
the loading of the steps (through StepMother).
It seems that it has something to do with the factories.rb file;
commenting out all of the factories in factories.rb allows Cucumber to
continue to load and run its tests, but obviously, all of the steps
that use the aforementioned factories fail, or become undefined.
Removing the pickle_steps.rb file also allows Cucumber to continue to
load and run its tests, but obviously, all of the steps that use
pickle_steps.rb become undefined.
Strangely enough, another portal for the same application (shared
models and factories.rb file), can run its Cucumber features without
experiencing this error - but some of the steps that use Pickle fail
as unambigous matches. Some of them pass.
Has anyone seen this error , or anything like it before?
Wow, that must be a big app!
The reason why this is happening is that pickle constructs a regexp based on all available 'factories' to keep clashes with other pickle steps to a minimum. The issue that you have reported is making me rethink this approach.
Could you post the exact stacktarce on a gist for me to look at please?, Or mail it to me off-list?
Short term solutions:
- have you tried setting pickle's config.adapters setting (in support/pickle.rb) to just :factory_girl (the default setting loads up 'factories' for all active_records as well)
- you could also try replacing #{capture_model} in the step definitions with (.*?) if you don;t get any ambiguous steps matches this should fix your issue. If you do get ambiguous steps, you can try adding your own regexp which suites your app
Long term solutions:
- use some delimiters in pickle steps so that we don't need to introspect on factories/predicate names, the downside to this is that pickle steps become uglier:
Given "a user" exists
anyone have any other ideas?
> --
> You received this message because you are subscribed to the Google Groups "pickle" group.
> To post to this group, send email to pickle-...@googlegroups.com.
> To unsubscribe from this group, send email to pickle-cucumb...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pickle-cucumber?hl=en.
>