【发布时间】:2014-07-03 20:22:44
【问题描述】:
我正在尝试测试某些实体是否与所有者实体正确关联。
class Recipe < ActiveRecord::Base
has_many :ingredients
end
我已经插入了成分,然后想测试它们是否属于给定的食谱。在黄瓜中我想测试类似的东西:
recipe.ingredients.should_contain(ingredient1, ingredient2)
我该如何测试这个?
【问题讨论】:
标签: ruby-on-rails cucumber rails-activerecord