Thomas Sonntag
2007-Oct-19 10:11 UTC
Bug in ActionMailer or TMail ? sideeffect in TMail::Mail#attachments
Consider the following test:
- create a trivial mail with one attachment
- #attachments returns nil (see test method #test_out below)
- however if I access the mail e.g. with #to_s then #attachments
returns the created attachment correctly
(see test method #test_out_with_side_effect below)
---------------------bla_test.rb---------------
class BlaMailer < ActionMailer::Base
def out
attachment :content_type => "text/plain",
:body => "attachment text",
:filename => "bla.txt"
end
end
---------------------bla_mailer_test.rb---------------
require File.dirname(__FILE__) + ''/../test_helper''
class BlaMailerTest < Test::Unit::TestCase
def test_out
m= BlaMailer.create_out
puts "attachments=#{m.attachments}"
assert_not_nil m.attachments
end
def test_out_with_side_effect
m= BlaMailer.create_out
m.to_s
puts "with side effect: attachments=#{m.attachments}"
assert_not_nil m.attachments
end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2007-Oct-25 07:58 UTC
Re: Bug in ActionMailer or TMail ? sideeffect in TMail::Mail#attachments
> Consider the following test: > - create a trivial mail with one attachment > - #attachments returns nil (see test method #test_out below) > - however if I access the mail e.g. with #to_s then #attachments > returns the created attachment correctly > (see test method #test_out_with_side_effect below)tmail has a new maintainer who''s probably interested in this test case. http://rubyforge.org/projects/tmail/ http://rubyforge.org/mailman/listinfo/tmail-talk -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---