ActiveMailer 测试在通过 ruby 运行时通过,但在 rake test:units 时未通过
我创建的 activemailer 测试遇到问题。当我直接用 ruby 运行测试时,测试通过了。当我运行所有单元测试时,它们都会失败,因为消息的编码方式发生了变化。
从 rake test:units 运行测试将电子邮件分成多个 mimepart,这些 mimepart 在运行 ruby unit/mailer_test.rb 时不存在。
有谁知道为什么以一种方式运行 Rails 测试会导致消息的编码方式与另一种方式不同?我的测试代码如下所示:
@expected.from = '[email protected]'
@expected.to = '[email protected]'
@expected.subject = "Regarding your inquiry"
@expected.body = read_fixture('response_email')
@expected.date = Time.now
assert_equal @expected.encoded.strip, Mailer.create_response_email("[email protected]").encoded.strip
谢谢!
-肯
I'm having trouble with an activemailer test I created. When I run the test directly with ruby, the test passes. When I run all the unit tests they fail, because the way the message is encoded changed.
Running the test from rake test:units breaks the email into multiple mimeparts, that do not exist when running ruby unit/mailer_test.rb.
Does anyone know why running rails tests one way would cause the message to be encoded differently from another way? The code for my test looks like this:
@expected.from = '[email protected]'
@expected.to = '[email protected]'
@expected.subject = "Regarding your inquiry"
@expected.body = read_fixture('response_email')
@expected.date = Time.now
assert_equal @expected.encoded.strip, Mailer.create_response_email("[email protected]").encoded.strip
Thanks!
-Ken
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论