Tom Hoen
2009-Oct-22 15:40 UTC
[rspec-users] Can''t figure you why I am getting deliver_from == Nil Using EmailSpec
Using EmailSpec, I am testing the format of emails sent from an observer. I can verify the deliver_to address, the bcc_to address, and that the message body has the appropriate text. However, when I test the deliver_from, I am getting an error saying my deliver_from is nil, though when I follow the same steps in development, an email is sent with the appropriate from address. This is the message I am getting: ''Event Notification should be sent from an address with the event description'' FAILED expected #<TMail::Mail port=#<TMail::StringPort:id=0x7342b8a> bodyport=#<TMail::StringPort:id=0x733f598>> to deliver from "mytest Classroom 42 : Janet Teacher1 <myemail at this.com>", but it delievered from nil Any insight you can provide would be greatly appreciated. Best, Tom Tom Hoen edgevale/interactive thoen at edgevaleinteractive.com ClassroomParent thoen at classroomparent.com 410-215-0905 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091022/576a15c5/attachment.html>
Ben Mabey
2009-Oct-22 22:36 UTC
[rspec-users] Can''t figure you why I am getting deliver_from == Nil Using EmailSpec
Tom Hoen wrote:> > Using EmailSpec, I am testing the format of emails sent from an observer. > > > > I can verify the deliver_to address, the bcc_to address, and that the > message body has the appropriate text. >How are you verifying this?> > > > However, when I test the deliver_from, I am getting an error saying my > deliver_from is nil, though when I follow the same steps in > development, an email is sent with the appropriate from address. This > is the message I am getting: > > > > ''Event Notification should be sent from an address with the event > description'' FAILED > > expected #<TMail::Mail port=#<TMail::StringPort:id=0x7342b8a> > bodyport=#<TMail::StringPort:id=0x733f598>> to deliver from "mytest > Classroom 42 : Janet Teacher1 <myemail at this.com>", but it delievered > from nil > > > > Any insight you can provide would be greatly appreciated. >deliver_to''s matches? method is as follows: def matches?(email) @email = email @actual_sender = (email.from || []).first @actual_sender.eql? @expected_email_addresses end On the email you are testing can you call ''from'' on it and see what it returns? -Ben