Sha256: 7564abcfeccab8709125434a211c81ea99f4266ca06ef1e6509ce9984dcc7730
Contents?: true
Size: 1.13 KB
Versions: 24
Compression:
Stored size: 1.13 KB
Contents
require 'spec_helper' describe FormatParser::PDFParser do let(:parsed_pdf) { subject.call( File.open( Pathname.new(fixtures_dir).join('PDF').join(pdf_file), 'rb' ) ) } shared_examples :behave_like_pdf do |hash| let(:pdf_file) { hash.fetch(:file) } it 'acts as a pdf' do expect(parsed_pdf).not_to be_nil expect(parsed_pdf.nature).to eq(:document) expect(parsed_pdf.format).to eq(:pdf) expect(parsed_pdf.content_type).to eq('application/pdf') end end describe 'a PDF file with a missing version header' do let(:pdf_file) { 'not_a.pdf' } it 'does not parse succesfully' do expect(parsed_pdf).to be_nil end end describe 'a PDF file with a correct header but no valid content' do let(:pdf_file) { 'broken.pdf' } pending 'does not parse succesfully' end describe 'exceeding the PDF read limit' do let(:pdf_file) { 'read_limit.pdf' } pending 'does not parse succesfully' end describe 'parses a PDF file' do describe 'a single page file' do include_examples :behave_like_pdf, file: '1_page.pdf' end end end
Version data entries
24 entries across 24 versions & 1 rubygems