diff options
author | Francis Irving <francis@mysociety.org> | 2009-12-22 14:57:01 +0000 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2009-12-22 14:57:01 +0000 |
commit | b0de7bfd5388a552ef58235f8cb590ff2696f10c (patch) | |
tree | d454ed558185cb5c021b718e651bee82e084468f /spec/models/incoming_message_spec.rb | |
parent | 69e8341c6f607838238e257c00fc916a09a6e5ee (diff) |
Test for attaching attachments case, where the email attached is off
type octet-stream, so we don't know it is an email until later.
Diffstat (limited to 'spec/models/incoming_message_spec.rb')
-rw-r--r-- | spec/models/incoming_message_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index f08f1338c..71d8da647 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -228,4 +228,24 @@ describe IncomingMessage, " when uudecoding bad messages" do end +describe IncomingMessage, "when messages are attached to messages" do + it "should flatten all the attachments out" do + mail_body = load_file_fixture('incoming-request-attach-attachments.email') + mail = TMail::Mail.parse(mail_body) + mail.base64_decode + + im = IncomingMessage.new + im.stub!(:mail).and_return(mail) + ir = InfoRequest.new + im.info_request = ir + + attachments = im.get_attachments_for_display + attachments.size.should == 3 + attachments[0].display_filename.should == 'Same attachment twice.txt' + attachments[1].display_filename.should == 'hello.txt' + attachments[2].display_filename.should == 'hello.txt' + end +end + + |