[英]Undefined method 'assert_select_email' in ActionMailer tests [Rails 3.2.13]
尝试在邮件测试中使用assert_select_email
时出现以下错误:
undefined method `assert_select_email' for ...
TestClass继承自< ActionMailer::TestCase
和其他断言,例如'assert_equal`工作。
如此处记录:
http://apidock.com/rails/ActionDispatch/Assertions/SelectorAssertions/assert_select_email
我设置
ActionMailer::Base.perform_deliveries = true
有任何想法吗? 哦我在用
看起来是因为它不在ActionMailer :: TestCase中
您要assert_emails吗?
您可能在测试类中包括ActionDispatch::Assertions::SelectorAssertions
。 像这样:
UserMailerTest < ActionMailer::TestCase
include ActionController::Assertions::SelectorAssertions
# …
end
然后,您应该可以使用assert_select_email
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.