regular expression is too big

瀏覽次數:66 次
跳到第一則未讀訊息

QuBiT

未讀,
2010年8月6日 清晨5:51:472010/8/6
收件者: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

未讀,
2010年8月6日 清晨6:16:122010/8/6
收件者: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

未讀,
2010年8月6日 清晨6:17:232010/8/6
收件者: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

未讀,
2010年8月6日 清晨6:21:402010/8/6
收件者: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
回覆所有人
回覆作者
轉寄
0 則新訊息