diff options
author | francis <francis> | 2009-04-07 16:01:00 +0000 |
---|---|---|
committer | francis <francis> | 2009-04-07 16:01:00 +0000 |
commit | 61af26a9c84ee78110181f0a60e3d8266340d302 (patch) | |
tree | 3db64191111d6184b39f10b7ab8ee92b9e96a9b7 | |
parent | c60fabe0ce4127b053cce990a97486f88f1a9d04 (diff) |
Start to add test for the mail reply address functions.
-rw-r--r-- | spec/models/request_mailer_spec.rb | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/models/request_mailer_spec.rb b/spec/models/request_mailer_spec.rb index 84d3cad2e..ed2bb84e9 100644 --- a/spec/models/request_mailer_spec.rb +++ b/spec/models/request_mailer_spec.rb @@ -4,7 +4,6 @@ describe RequestMailer, " when receiving incoming mail" do fixtures :info_requests, :incoming_messages, :raw_emails, :users, :public_bodies before do - end it "should append it to the appropriate request" do @@ -68,4 +67,35 @@ And a paragraph afterwards." end +describe RequestMailer, " when working out follow up addresses" do + # doing this with fixtures as the code is a bit tangled with the way it + # calls TMail, and the TMail monkey patches in conf/environment.rb + # XXX untangle it and make these tests spread out and using mocks. Might + # mean properly patching TMail. + fixtures :info_requests, :incoming_messages, :raw_emails, :public_bodies + + it "should parse them right" do + ir = info_requests(:fancy_dog_request) + im = ir.incoming_messages[0] + + # check the basic entry in the fixture is fine + RequestMailer.name_and_email_for_followup(ir, im).should == "FOI Person <foiperson@localhost>" + RequestMailer.name_for_followup(ir, im).should == "FOI Person" + RequestMailer.email_for_followup(ir, im).should == "foiperson@localhost" + end + +# it "should escape funny characters" do +# ir = info_requests(:fancy_dog_request) +# im = ir.incoming_messages[0] +# +# im.raw_email.data.sub!("FOI Person", "FOI \\\" Person") +# +# # check the basic entry in the fixture is fine +# RequestMailer.name_and_email_for_followup(ir, im).should == "\"FOI \\\" Person\" <foiperson@localhost>" +# RequestMailer.name_for_followup(ir, im).should == "FOI Person" +# RequestMailer.email_for_followup(ir, im).should == "foiperson@localhost" +# end + +end + |