aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/foi_attachment_spec.rb
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-02-03 13:38:59 +0000
committerRobin Houston <robin.houston@gmail.com>2012-02-03 13:38:59 +0000
commit44bb96d40758f3b8bb9da20e3037ff2f04e81327 (patch)
tree2f43c9c02205fec1fb68cdcb66735d5b1ee3172f /spec/models/foi_attachment_spec.rb
parent7ed887f0989425d9e412890800df05637b08c025 (diff)
parent14b5be69dc2dc3c4dd817feb0b5a8402fc343db4 (diff)
Merge branch 'release/0.5'
Diffstat (limited to 'spec/models/foi_attachment_spec.rb')
-rw-r--r--spec/models/foi_attachment_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/models/foi_attachment_spec.rb b/spec/models/foi_attachment_spec.rb
new file mode 100644
index 000000000..9d44957e4
--- /dev/null
+++ b/spec/models/foi_attachment_spec.rb
@@ -0,0 +1,35 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe FoiAttachment, " when calculating due date" do
+
+ before(:each) do
+ load_raw_emails_data
+ end
+
+ it "sets the body" do
+ attachment = FoiAttachment.new
+ attachment.body = "baz"
+ attachment.body.should == "baz"
+ end
+ it "sets the size" do
+ attachment = FoiAttachment.new
+ attachment.body = "baz"
+ attachment.body.should == "baz"
+ attachment.update_display_size!
+ attachment.display_size.should == "0K"
+ end
+ it "reparses the body if it disappears" do
+ im = incoming_messages(:useless_incoming_message)
+ im.extract_attachments!
+ main = im.get_main_body_text_part
+ orig_body = main.body
+ main.delete_cached_file!
+ lambda {
+ 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