1
下面的代碼將參數傳遞給黃瓜的步驟定義:傳遞多個參數,以黃瓜的步驟定義
Then /^I should see a message "([^\"]*)"$/ do |arg1|
page.should have_content (arg1)
end
任何人都可以幫助我,如何傳遞多個參數?
下面的代碼將參數傳遞給黃瓜的步驟定義:傳遞多個參數,以黃瓜的步驟定義
Then /^I should see a message "([^\"]*)"$/ do |arg1|
page.should have_content (arg1)
end
任何人都可以幫助我,如何傳遞多個參數?
爲了傳遞多個參數,您需要有多個「捕獲組」。以下是一個具有兩個捕獲組的示例:
Then /^I should see a message "([^\"]*)" and another message "([^\"]*)" $/ do |arg1, arg2|
page.should have_content(arg1)
page.should have_content(arg2)
end