Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找一种方便的方法来测试基于改革的表单对象的验证。
是否有任何匹配器(例如用于测试 ActiveModel::Validations 的匹配器)来测试干验证?这甚至是要走的路吗?
有这个:https ://github.com/bloom-solutions/dry-validation-matchers
我过去很喜欢使用 shoulda 匹配器。它有助于大大减少您首先创建有效对象然后将受验证影响的属性更改为无效值以执行测试的重复代码。
最后,这只是一个品味问题。