regular expression is too big

66 views
Skip to first unread message

QuBiT

unread,
Aug 6, 2010, 5:51:47 AM8/6/10
to pickle
Hi,

I am getting the following error:

regular expression is too big .... [a console window full of
expressions]

caused by

./features/step_definitions/pickle_steps.rb:64
--> Then(/^#{capture_model} should (?:be|have) (?:an? )?
#{capture_predicate}$/) do |name, predicate|

and (when removing (documenting out) that step on line 64)

./features/step_definitions/pickle_steps.rb:73
--> Then(/^#{capture_model} should not (?:be|have) (?:an? )?
#{capture_predicate}$/) do |name, predicate|

tested with pickle 0.3.0, 0.3.3, 0.3.4 on rails3.0.0.rc with cucumber
0.8.5 upgraded from rails2.3.5

The error is caused by "capture_predicate" which produces the regexp
(simple having to many different predicates for too many models ?!)

When I remove both steps everything is fine again.

How can I change this, so that I am able to use those steps?

QuBiT

unread,
Aug 6, 2010, 6:16:12 AM8/6/10
to pickle
additional info to the message above:

with rails2.3.5 this steps work without error on the same application.
(using factory_girl 1.2.4, pickle 0.3.0)

Ian White

unread,
Aug 6, 2010, 6:17:23 AM8/6/10
to pickle-...@googlegroups.com
Hi there,

This is a problem that I'm working on with pickle.

The reason why the code constructs such an expression is to stop ambiguous step collisions for the should be <predicate> steps.

Until I come up with a general solution, you can try the following:

You can try replacing the #{capture_predicate} with something like (\w[\w ]+\w), but that is likely to cause ambiguous step problems.

If you do have this problem, there are two other things to try.

In Pickle.configure, try restricting the predicates to those you need:

Pickle.configure do |config|
config.predicates = %w(small? large? green?)
end

Or, if this is not appealing, replace #{capture_predicate} with "(\w[\w ]+\w)" (adding quotes around the above one)

This means you;ll have to rewrite these steps with quotes. ie.

Then the 2nd user should be activated

becomes

Then the 2nd user should be "activated"

The quotes should remove any ambiguous step clashes.

Let me know how you get on.

Cheers,
Ian


If it does you have two option

> --
> 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.
>

QuBiT

unread,
Aug 6, 2010, 6:21:40 AM8/6/10
to pickle
Thanks for your fast reply.

Currently I am not needing those steps (but as they are defined and
loaded, they caused that error) so I documented them out.

If I need them I will try your suggested workarounds.

Thanks and Cheers
Reply all
Reply to author
Forward
0 new messages