From 9a1c9a31ef5fe8b67dfc1d542eebf6b71db8c48e Mon Sep 17 00:00:00 2001 From: Michael Klett Date: Sat, 13 Dec 2008 22:51:38 +0800 Subject: [PATCH] Add specs testing the behavior of the Reply-To header on sent mails. Signed-off-by: Radiant CMS dev team --- spec/models/mail_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/models/mail_spec.rb b/spec/models/mail_spec.rb index 6dc4e39..e1b36a8 100644 --- a/spec/models/mail_spec.rb +++ b/spec/models/mail_spec.rb @@ -149,6 +149,24 @@ @mail.send.should be_false @mail.errors['base'].should == "Boom!" end + + it "should set the Reply-To header on the sent mail to the reply_to value given in the configuration" do + @mail.config[:reply_to] = "reply_to@example.com" + @mail.send + ActionMailer::Base.deliveries.last.reply_to.should == [@mail.config[:reply_to]] # reply_to on TMail is an Array + end + + it "should set the Reply-To header on the sent mail to the reply_to_field data value given in the configuration" do + @mail.config[:reply_to_field] = 'email' + @mail.data['email'] = 'reply_to_field@example.com' + @mail.send + ActionMailer::Base.deliveries.last.reply_to.should == [@mail.data['email']] # reply_to on TMail is an Array + end + + it "should set the Reply-To header on the sent mail to the from value when the configuration does not specify a reply_to" do + @mail.send + ActionMailer::Base.deliveries.last.reply_to.should == ['foo@baz.com'] # reply_to on TMail is an Array + end describe "when the page has no email body specified" do it "should render the submitted data as YAML to the plain body" do