In Rails why is my mail body empty only in my test?

后端 未结 1 1116
小蘑菇
小蘑菇 2021-02-18 20:00

I have an actionmailer class and associated overhead, it works perfectly. In my unit test (rails default minitest) however, the email body is empty. Why is that?

my mail

1条回答
  •  我在风中等你
    2021-02-18 20:25

    You probably have two versions of the email templates (text.erb and html.erb).

    If so, you can use email.text_part.body.to_s for plain-text email and email.html_part.body.to_s for HTML version.

    0 讨论(0)
提交回复
热议问题