[英]How do I skip certain Model Validations in Rails for speeding up Unit tests
我使用此gem https://github.com/validates-email-format-of/validates_email_format_of在我的模型中对电子邮件进行了验证,因为这会导致速度变慢,因此如何跳过测试的验证检查。
Add a conditional to the validation as the gem has that option. 为验证添加条件,因为gem具有该选项。 So
所以
validates_email_format_of :email, :message => 'is not looking good', unless: "Rails.env.test?"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.