diff options
Diffstat (limited to 'spec/models/incoming_message_spec.rb')
-rw-r--r-- | spec/models/incoming_message_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index 0cfdeac3a..f41dff06d 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -174,6 +174,13 @@ describe IncomingMessage, " when censoring data" do masked_text.should match(/xxx@xxx.xxx.xx/) end + it "should not produce zero length output if pdftk silently fails" do + orig_pdf = load_file_fixture('psni.pdf') + pdf = orig_pdf.dup + @im.binary_mask_stuff!(pdf, "application/pdf") + pdf.should_not == "" + end + it "should apply censor rules to HTML files" do data = @test_data.dup @im.html_mask_stuff!(data) @@ -268,5 +275,23 @@ describe IncomingMessage, "when Outlook messages are attached to messages" do end end +describe IncomingMessage, "when TNEF attachments are attached to messages" do + it "should flatten all the attachments out" do + mail_body = load_file_fixture('incoming-request-tnef-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 == 2 + attachments[0].display_filename.should == 'FOI 09 02976i.doc' + attachments[1].display_filename.should == 'FOI 09 02976iii.doc' + end +end + |