Then /^the string has (not )?(#{DQSRE})$/ do |not, inh|
if not.nil?
expect( @string).to match /#{inh}/
else
expect( @string).not_to match /#{inh}/
end
end
Then 'the string has (not ){dqs}' do |not, dqs|
Your block takes 2 arguments, but the Regexp matched 1 argument. (Cucumber::Glue::ArityMismatchError)
Then /the string has (not )?{dqs}/ do |not, dqs|
does not work because the {dqs} syntax is not a valid regular expression replacement for using the parametertype.
When I want to have a optional text captured, do I have to create a parametertype for that too (I guess the same goes for alternation, which is not captured either)?
Or am I overlooking something?
thanks in advance, Ruud
Then 'the string has {dqs}' do |dqs|
expect( @string).to match /#{inh}/
end
Then 'the string does not have {dqs}' do |dqs|
expect( @string).not_to match /#{inh}/
end--thanks in advance, Ruud
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Haha, I just read your response after replying myself, and saw that you beat me to it!
On Thursday, December 14, 2017, Chuck van der Linden <sqa...@gmail.com> wrote:
On Wednesday, December 13, 2017 at 1:02:46 PM UTC-8, Aslak Hellesøy wrote:Haha, I just read your response after replying myself, and saw that you beat me to it!HAH "ninja a cucumber dev with the correct answer" Achievement Unlocked! HAR!so'kay, validates my answer to see it also coming from you...
and... it's NOT the same code inside each definition, so it is not violating DRY if you ask me.and I agree about simplicity and clarity being paramount.So what about the second aspect to this I raised in my answer? how do we express non capture groups in the new expression syntax?Can you give (me )an example of a regexp?I’ll translate it for you.
And /^once the files? (?:have|has) finished processing$/ do
That would match both of the followingI (?:have |)(?:log|logged) in as: (\w+)--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
On Thursday, December 14, 2017 at 11:58:01 AM UTC-8, Aslak Hellesøy wrote:
On Thursday, December 14, 2017, Chuck van der Linden <sqa...@gmail.com> wrote:
On Wednesday, December 13, 2017 at 1:02:46 PM UTC-8, Aslak Hellesøy wrote:Haha, I just read your response after replying myself, and saw that you beat me to it!HAH "ninja a cucumber dev with the correct answer" Achievement Unlocked! HAR!so'kay, validates my answer to see it also coming from you...
and... it's NOT the same code inside each definition, so it is not violating DRY if you ask me.and I agree about simplicity and clarity being paramount.So what about the second aspect to this I raised in my answer? how do we express non capture groups in the new expression syntax?Can you give (me )an example of a regexp?I’ll translate it for you.Sure thing... So here's an example both of non-capturing groups combined with alternation, also with a single character that may or may not occurAnd /^once the files? (?:have|has) finished processing$/ do
That would match both of the following
- And once the file has finished processing
- And once the files have finished processing
Another example of one I use a lotI (?:have |)(?:log|logged) in as: (\w+)
That's a step I use both as a Given or a When, hence the change in tense.. so that capture would match both
- Given I have logged in as: fizz
- When I log in as: buzz
(If we have nothing in the docs showing how to do those sorts of step definitions via the new expression, I think it would be good to include them..
--Chuck--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+unsubscribe@googlegroups.com.
See replies inline