How to make a brine step for a hash type field for a mongoid

class Person
  include Mongoid::Document

  field :address, :type => Hash

end

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

Shows an 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 a standard maturation step?

+3
source share
1 answer

I don’t think that you can create a person and an address in just one step without creating your own definition of the step (which is quite simple). You can split your function into 2 lines as follows:

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

Source: https://habr.com/ru/post/1777638/


All Articles