diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-02-14 18:56:16 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-02-14 19:03:40 +0000 |
commit | bc0cc811e80143d0255d86433a80a823d1141dd0 (patch) | |
tree | 0c5005b2b03e540d8ab562da06539414709fbc18 /spec/models | |
parent | 6fa9c17c7cd5551489a77f6e89543b7886be51d4 (diff) | |
parent | 2c5749d4d92e6601856cef6f7e2201d06d885183 (diff) |
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/foi_attachment_spec.rb | 13 | ||||
-rw-r--r-- | spec/models/incoming_message_spec.rb | 7 | ||||
-rw-r--r-- | spec/models/request_mailer_spec.rb | 2 |
3 files changed, 20 insertions, 2 deletions
diff --git a/spec/models/foi_attachment_spec.rb b/spec/models/foi_attachment_spec.rb index 9d44957e4..537a3363c 100644 --- a/spec/models/foi_attachment_spec.rb +++ b/spec/models/foi_attachment_spec.rb @@ -30,6 +30,17 @@ describe FoiAttachment, " when calculating due date" do main.delete_cached_file! main = im.get_main_body_text_part main.body.should == orig_body - + end end + +describe FoiAttachment, "when ensuring a filename is present" do + + it 'should create a filename for an instance with a blank filename' do + attachment = FoiAttachment.new + attachment.filename = '' + attachment.ensure_filename! + attachment.filename.should == 'attachment.bin' + end + +end diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb index 6fc0ff3cc..f53a5856a 100644 --- a/spec/models/incoming_message_spec.rb +++ b/spec/models/incoming_message_spec.rb @@ -148,6 +148,13 @@ describe IncomingMessage, " folding quoted parts of emails" do @incoming_message.remove_lotus_quoting(text).should match(/FOLDED_QUOTED_SECTION/) end + it 'should not error when trying to fold lotus notes quoted parts on a request with no user_name' do + text = "hello" + @incoming_message = IncomingMessage.new() + @incoming_message.stub_chain(:info_request, :user_name).and_return(nil) + @incoming_message.remove_lotus_quoting(text).should == 'hello' + end + it "cope with [ in user names properly" do @incoming_message = IncomingMessage.new() @incoming_message.stub_chain(:info_request, :user_name).and_return("Sir [ Bobble") diff --git a/spec/models/request_mailer_spec.rb b/spec/models/request_mailer_spec.rb index 0f09e6926..5edc8edb6 100644 --- a/spec/models/request_mailer_spec.rb +++ b/spec/models/request_mailer_spec.rb @@ -98,7 +98,7 @@ describe RequestMailer, " when receiving incoming mail" do mail.multipart?.should == true mail.parts.size.should == 2 message_part = mail.parts[0].to_s - bounced_mail = MailHandler.mail_from_raw_email(mail.parts[1].body, decode=false) + bounced_mail = MailHandler.mail_from_raw_email(mail.parts[1].body) bounced_mail.to.should == [ ir.incoming_email ] bounced_mail.from.should == [ 'geraldinequango@localhost' ] bounced_mail.body.include?("That's so totally a rubbish question").should be_true |