From 43a21cd57f6aafb94698b5324aaac0f3c106319f Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 6 Dec 2012 11:27:23 +0000 Subject: Stub the close method on the object we're passing to the zip file extraction function. --- spec/lib/mail_handler/mail_handler_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'spec/lib/mail_handler/mail_handler_spec.rb') 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 -- cgit v1.2.3