ruby-on-rails - 如何使Mongoid的哈希类型字段的 pickle 步骤

标签 ruby-on-rails pickle mongoid

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/

相关文章:

ruby-on-rails - 如何使用 HTTParty gem 与 Rails5 中的外部搜索 API 交互?

python - pickle 字符串的更有效方法

python - 无法执行 pickle.load

Python - 以高性能序列化数据的最佳方式?

mongodb - 在 MongoDB 文档中获取文档的键

ruby-on-rails - 安装 Mongoid 后使用 Active Record 生成器?

ruby-on-rails - rails 3 : Passenger can't find git gems installed by bundler

ruby-on-rails - Rails 应用程序作为 LDAP 或 CardDAV 服务器?

ruby - 如何使用any_of和any_in在ruby中查询MongoID?

ruby-on-rails - rails : Facebook Connect: Client Side/Server Side or Both?