I am writing an action mailer test and am trying to snatch contents
of the @body hash provided for the template for testing. Specifically,
my plan is to do something like:
def render_message method, body
self.original_body = body
super method, body
and then test that a FooMailer instance has its original_body setup
correctly (together with to, from and other headers).
However, I noticed that ActionMailer::Base goes out of its way to
prevent instantiating mailer objects. Why does it do that?
PS I realize that usual approach is just use pattern matching for the
resulting TMail body. However such method seems to strongly couple the
test to the email body template (e.g. I may setup the body[:profile]
but the email resulting body may only contain the @profile.name, so
the test has to know that the template renders just the name and
change if the template changes)