aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-12-06 11:27:23 +0000
committerLouise Crow <louise.crow@gmail.com>2012-12-06 14:15:59 +0000
commit43a21cd57f6aafb94698b5324aaac0f3c106319f (patch)
tree49718955e65c5d512df4b07c160ce4b905e3000a /spec/lib
parentbde6ceeb95295ddb9b018530833a9f12280fa341 (diff)
Stub the close method on the object we're passing to the zip file extraction function.
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/mail_handler/mail_handler_spec.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/spec/lib/mail_handler/mail_handler_spec.rb b/spec/lib/mail_handler/mail_handler_spec.rb
index 3ccccc6bc..99ab8096f 100644
--- a/spec/lib/mail_handler/mail_handler_spec.rb
+++ b/spec/lib/mail_handler/mail_handler_spec.rb
@@ -264,8 +264,10 @@ end
describe "when getting the attachment text" do
it "should not raise an error if the expansion of a zip file raises an error" do
mock_entry = mock('ZipFile entry', :file? => true)
+ mock_entries = [mock_entry]
+ mock_entries.stub!(:close)
mock_entry.stub!(:get_input_stream).and_raise("invalid distance too far back")
- Zip::ZipFile.stub!(:open).and_return([mock_entry])
+ Zip::ZipFile.stub!(:open).and_return(mock_entries)
MailHandler.get_attachment_text_one_file('application/zip', "some string")
end