If you want to capture a variable number of inputs in a single step, I think the best option is to use scan
. While you cannot use scan directly in the step name, you can capture the full list of files and then parse the captured result.
Try the following step definition:
Given /^I attach (.*)$/ do |file_list|
files = file_list.scan(/"(.+?)"/).flatten
#=> ["dog.png", "cat.png", "alphabet.doc"]
end
This will create an array of files to attach. It can handle 1 to infinite files.