aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-06-06 12:23:19 +0100
committerGareth Rees <gareth@mysociety.org>2014-06-06 12:24:55 +0100
commit895fffedf54ae9ea4168cf03ca5aa55f93a93b49 (patch)
treecd9c024604f4b95a73e61e41be952efd9668b61e /spec/lib
parent6f415fca07b438e4d4ca84e7c2efdee62db8ce48 (diff)
Handle converting empty RTF fileshotfix/0.18.0.3
Fixes https://github.com/mysociety/alaveteli/issues/1563
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/attachment_to_html/adapters/rtf_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/lib/attachment_to_html/adapters/rtf_spec.rb b/spec/lib/attachment_to_html/adapters/rtf_spec.rb
index a3bf0e27e..2c53b5272 100644
--- a/spec/lib/attachment_to_html/adapters/rtf_spec.rb
+++ b/spec/lib/attachment_to_html/adapters/rtf_spec.rb
@@ -60,6 +60,17 @@ describe AttachmentToHTML::Adapters::RTF do
adapter.body.should_not include('//W3C//DTD HTML 4.01 Transitional//EN')
end
+ it 'converts empty files' do
+ attachment = FactoryGirl.build(:rtf_attachment, :body => load_file_fixture('empty.rtf'))
+ adapter = AttachmentToHTML::Adapters::RTF.new(attachment)
+ adapter.body.should == ''
+ end
+
+ it 'doesnt fail if the external command returns nil' do
+ AlaveteliExternalCommand.stub(:run).and_return(nil)
+ adapter.body.should == ''
+ end
+
end