How to make pickle step for hash type field for mongoid
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
精彩评论