开发者

How to make pickle step for hash type field for mongoid

开发者 https://www.devze.com 2023-01-27 08:54 出处:网络
class Person in开发者_高级运维clude Mongoid::Document field :address, :type => Hash end Given a person exist with address: {:city => \"city\", :street => \"street\"}
class Person
  in开发者_高级运维clude Mongoid::Document

  field :address, :type => Hash

end

Given a person exist with address: {:city => "city", :street => "street"}

Shows undefined step as:

Given /^a person exists with address: \{:city => "([^"]*)", :street => "([^"]*)"\}$/ do |arg1, arg2|
  pending # express the regexp above with the code you wish you had
end

How can I make it standard pickle step?


I don't think you can create the person and the address all in one step without creating your own step definition (which is pretty easy). You can split your feature into 2 lines like this:

Given an address exists with city: "Townsville" and street: "123 Main St."
And a person exists with address: the address
0

精彩评论

暂无评论...
验证码 换一张
取 消