require 'spec_helper' describe RubyTikaApp do before(:each) do @test_file = "#{File.join(File.dirname(__FILE__))}/docs/graph sampling simplex - 11.pdf" end describe 'Error' do it 'has an error' do expect { rta = RubyTikaApp.new('No file') rta.to_xml }.to raise_error end end describe '#to_xml' do it 'header' do rta = RubyTikaApp.new(@test_file) rta.to_xml[0..37].should == "" end it 'middle' do rta = RubyTikaApp.new(@test_file) xml = rta.to_xml xml_size = xml.size / 2 xml[xml_size..(xml_size + 100)].should == "S (Section IV). Besides,\nMHRW performs better in well connected graphs than in\nloosely connected grap" end end describe '#to_html' do it 'header' do rta = RubyTikaApp.new(@test_file) rta.to_html[0..42].should == "" end it 'middle' do rta = RubyTikaApp.new(@test_file) rta.to_html[1000 ... 1100].should == "rceName\" content=\"graph sampling simplex - 11.pdf\"/>\n