ruby - Get all items inside quotes in Cucumber Step Definition -


i have string: i attach "dog.png", "cat.png", , "alphabet.doc"

this want matched:

1. dog.png 2. cat.png 3. alphabet.doc 

i can doing "([^"]*)", however, string has start 'i attach'

this current rule have in step definition: /^i attach "([^"]*)"$/ doesn't work.

this cucumber/gherkin, can figure out using scan don't think can use in cuke/gherkin?

any suggestions on how this?

thanks

if want capture variable number of inputs in single step, think best option use scan. while cannot use scan directly in step name, can capture full list of files , parse captured result.

try following step definition:

given /^i attach (.*)$/ |file_list|   files = file_list.scan(/"(.+?)"/).flatten   #=> ["dog.png", "cat.png", "alphabet.doc"] end 

this create array of files attach. can handle 1 infinite files.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -