From d60430da5d407db137c8ec0b73cc31cbf29837c3 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 2 Apr 2015 10:16:52 +0100 Subject: Handle the expected case where conversion fails and returns nil. --- spec/lib/attachment_to_html/adapters/pdf_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spec/lib/attachment_to_html') diff --git a/spec/lib/attachment_to_html/adapters/pdf_spec.rb b/spec/lib/attachment_to_html/adapters/pdf_spec.rb index f1ae4695c..ceb438be8 100644 --- a/spec/lib/attachment_to_html/adapters/pdf_spec.rb +++ b/spec/lib/attachment_to_html/adapters/pdf_spec.rb @@ -71,6 +71,11 @@ describe AttachmentToHTML::Adapters::PDF do adapter.success?.should be_false end + it 'is not successful if convert returns nil' do + adapter.stub(:convert).and_return(nil) + adapter.success?.should be_false + end + it 'is not successful if the body contains more than 50 images' do # Sometimes pdftohtml extracts images incorrectly, resulting # in thousands of PNGs being created for one image. This creates -- cgit v1.2.3