我的用户模型有一个rails 4验证:
has_many :items, -> { order(:position) }
我期望以下应该匹配的工作:
it {should have_many(:items).order(:position)}
但它引发了这个错误:
Expected User to have a has_many association called items (items should be ordered by position)
我的语法错误测试了吗?
答案 0 :(得分:3)
v2.4.0中存在一个错误,但这不起作用。这已在v2.5.0中修复,所以请查看它!
请点击此处了解详情:https://github.com/thoughtbot/shoulda-matchers/issues/388