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
我如何使其成为标准的酱菜步骤?
最佳答案
我认为您不能在不创建自己的步骤定义的情况下一步一步地创建人和地址(这很简单)。您可以将特征分成两行,如下所示:
Given an address exists with city: "Townsville" and street: "123 Main St."
And a person exists with address: the address
关于ruby-on-rails - 如何使Mongoid的哈希类型字段的 pickle 步骤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4313211/