I'm new to Cucumber/Capybara, I want to know How Can I Import data from txt/xls files using Cucumber/Capybara
for example I need to use next Scenario to Upload several files one after another :
feature
Scenario: Upload
When I Choose A name "name"
When I Choose "/home/path"
Then I Click Upload
step_definitions
When(/^I Choose A name "([^"]*)"$/) do |title|
fill_in('video_title', :with => title)
fill_in('video_description', :with => title)
end
When(/^I Choose "([^"]*)"$/) do |file|
find(:xpath, '//*[@id="file"]', :visible => false).set(file)
end
Then(/^I Click Upload$/) do
click_button('Upload')
end
so if i can add step definition to import from txt or xls that will be much easier then repeating Scenario for every file