tokhi
tokhi

Reputation: 21618

passing multiple arguments to cucumber step definitions

Below code passes an argument to a cucumber step definitions:

Then /^I should see a message "([^\"]*)"$/ do |arg1|
  page.should have_content (arg1)
end

Anyone could help me, how to pass multiple arguments?

Upvotes: 1

Views: 3912

Answers (1)

Peter Brown
Peter Brown

Reputation: 51697

In order to pass multiple arguments, you need to have multiple "capture groups". Here's an example that has two capture groups:

Then /^I should see a message "([^\"]*)" and another message "([^\"]*)" $/ do |arg1, arg2|
  page.should have_content(arg1)
  page.should have_content(arg2)
end

Upvotes: 5

Related Questions