From 08572fe8d0ad97c01ecc5c0f0ee39e610de383a3 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 1 Apr 2014 11:59:26 +0100 Subject: Work around a bug in unrtf --- spec/lib/attachment_to_html/adapters/rtf_spec.rb | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'spec/lib/attachment_to_html') diff --git a/spec/lib/attachment_to_html/adapters/rtf_spec.rb b/spec/lib/attachment_to_html/adapters/rtf_spec.rb index f84073c51..75fd467f6 100644 --- a/spec/lib/attachment_to_html/adapters/rtf_spec.rb +++ b/spec/lib/attachment_to_html/adapters/rtf_spec.rb @@ -69,6 +69,31 @@ describe AttachmentToHTML::Adapters::RTF do rtf_adapter.to_html end + it 'does not result in incorrect conversion when unrtf returns an invalid doctype' do + # Doctype public identifier is unquoted + # Valid doctype would be: + # + # See bug report http://savannah.gnu.org/bugs/?42015 + invalid = <<-DOC + + + + + + + + + thisisthebody + + DOC + AlaveteliExternalCommand.stub(:run).and_return(invalid) + + parsed = Nokogiri::HTML.parse(rtf_adapter.to_html) do |config| + config.strict + end + parsed.css('body').inner_text.should_not include('//W3C//DTD HTML 4.01 Transitional//EN') + end + end describe :success? do -- cgit v1.2.3