繁体   English   中英

ActionMailer测试中未定义的方法'assert_select_email'[Rails 3.2.13]

[英]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

有任何想法吗? 哦我在用

  • 导轨3.2.13

看起来是因为它不在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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM