Okay, solution found.  Requires a combination of two tricks:

1. content_type has to be set after the parts, as you get the error
above otherwise.  Maybe a bug in TMail, who knows.  At least there is
a workaround.

2. Boundary strings need mangling.  I created myself a convenience
method which will ultimately end up in my test helper if I have more
than one notification model later.

  def assert_mail_equal(expected_mail, actual_mail)
    assert_equal replace_boundary_strings(expected_mail.encoded),
                 replace_boundary_strings(actual_mail.encoded)
  end

  def replace_boundary_strings(str)
    boundary_pattern = 'mimepart_[0-9a-f]+_[0-9a-f]+'
    str = str.gsub(/(Content-Type: multipart\/mixed; boundary=)\"?#
{boundary_pattern}\"?/, "\\1replaced")
    str = str.gsub(/--#{boundary_pattern}/, "--replaced")
  end

I had suspected there was a second solution in tricking TMail into
generating the same boundary string on calls to new_boundary, but I
couldn't get that to work.

TX

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to