require 'spec_helper' describe RubyTikaApp do before(:each) do doc_path = "#{File.join(File.dirname(__FILE__))}/docs" @test_file = "#{doc_path}/graph sampling simplex - 11.pdf" @cnn_com_file = "#{doc_path}/cnn.com" @news_ycombinator_com_file = "#{doc_path}/news.ycombinator.com" end describe 'Error' do it 'has an error' do expect do rta = RubyTikaApp.new('No file') rta.to_xml end.to raise_error(RuntimeError) end end describe '#to_xml' do it 'header' do rta = RubyTikaApp.new(@test_file) expect(rta.to_xml[0..37]).to eq('') end it 'middle' do rta = RubyTikaApp.new(@test_file) xml = rta.to_xml xml_size = xml.size / 2 expect(xml[xml_size..(xml_size + 100)]).to eq("ph\nG. This methodology is also used in Frontier Sampling (FS).\nSince this is the only difference betw") end end describe '#to_html' do it 'header' do rta = RubyTikaApp.new(@test_file) expect(rta.to_html[0..42]).to eq('') end it 'middle' do rta = RubyTikaApp.new(@test_file) expect(rta.to_html[1000...1100]).to eq("Z\"/>\n\n