class Person
include Mongoid::Document
field :address, :type => Hash
end
Given a person exist with address: {:city => "city", :street => "street"}
将未定义的步骤显示为:
Given /^a person exists with address: \{:city => "([^"]*)", :street => "([^"]*)"\}$/ do |arg1, arg2|
pending # express the regexp above with the code you wish you had
end
如何使其成为标准的泡菜步骤?
答案 0 :(得分:1)
我不认为你可以在不创建自己的步骤定义的情况下一步创建人和地址(这很简单)。您可以将功能分为两行,如下所示:
Given an address exists with city: "Townsville" and street: "123 Main St."
And a person exists with address: the address