Cucumber 我是一个新的工厂女孩使用黄瓜与水

Cucumber 我是一个新的工厂女孩使用黄瓜与水,cucumber,factory-bot,watir-webdriver,Cucumber,Factory Bot,Watir Webdriver,我有以下步骤定义: And(/^I enter my credentials and submit$/) do on(LoginPage) do |page| page.login_with($test_user['email_address'], $test_user['password']) page.click_login_button end end 还有我的工厂女孩 Factory.define :user do |u| u.eamail 'radhase

我有以下步骤定义:

And(/^I enter my credentials and submit$/) do
  on(LoginPage) do |page|
    page.login_with($test_user['email_address'], $test_user['password'])
    page.click_login_button
  end
end
还有我的工厂女孩

Factory.define :user do |u|
  u.eamail 'radhasel9@gmail.com'
  u.password  '123456'
  u.admin true
end

那么,我如何才能将factory girl数据传递到步骤定义中呢?

factory girl是一种旨在模拟活动记录来测试模型的工具,它不仅仅是神奇地连接并为您创建步骤定义。如果要在步骤定义中使用factory girl,则需要将其包含在步骤定义中


然后,您可以使用factory girl简单地定义任何步骤

非常感谢您的资源链接
World FactoryGirl::Syntax::Methods