diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2012-01-13 09:10:41 +0000 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2012-01-13 09:10:41 +0000 |
commit | 840bc470558ffd34e7157dbdeb67572273445aa8 (patch) | |
tree | 6c86f6cd3f4d27d13e2439d5eacb89beef16f42e /spec/models | |
parent | b45f90a6f303dc495bd6897717dfb1be0cc7425a (diff) |
To get around occasional race conditions, instead of forcing an fsync, retry getting the body a few times before failing. May be related to issue #333 and #339
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/foi_attachment_spec.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/spec/models/foi_attachment_spec.rb b/spec/models/foi_attachment_spec.rb index d8166dddc..05c4fc5fd 100644 --- a/spec/models/foi_attachment_spec.rb +++ b/spec/models/foi_attachment_spec.rb @@ -20,17 +20,17 @@ describe FoiAttachment, " when calculating due date" do attachment.display_size.should == "0K" end it "reparses the body if it disappears" do - mail_body = load_file_fixture('incoming-request-attach-attachments.email') - mail = TMail::Mail.parse(mail_body) - mail.base64_decode im = incoming_messages(:useless_incoming_message) - im.stub!(:mail).and_return(mail) - #im.extract_attachments! - attachments = im.get_attachments_for_display - FileUtils.rm attachments[0].filepath + im.extract_attachments! + main = im.get_main_body_text_part + orig_body = main.body + main.delete_cached_file! lambda { - attachments = im.get_attachments_for_display - body = attachments[0].body + im.get_main_body_text_part.body }.should_not raise_error(Errno::ENOENT) + main.delete_cached_file! + main = im.get_main_body_text_part + main.body.should == orig_body + end end |