Sha256: fe05d661fdca4a12b07f13a1e72d3a1cbe0b77eb6d47044a8716405f5b09f77c

Contents?: true

Size: 795 Bytes

Versions: 16

Compression:

Stored size: 795 Bytes

Contents

require 'test_helper'
require 'ndr_import/helpers/file/pdf'

# PDF file helper tests
class PdfTest < ActiveSupport::TestCase
  # This is a test importer class to test the PDF file helper mixin
  class TestImporter
    include NdrImport::Helpers::File::Pdf
  end

  def setup
    @permanent_test_files = SafePath.new('permanent_test_files')
    @importer = TestImporter.new
  end

  test 'read_pdf_file helper should read pdf file' do
    file_content = @importer.send(:read_pdf_file, @permanent_test_files.join('hello_world.pdf'))
    assert_equal file_content, ['Hello World']
  end

  test 'read_pdf_file helper should raise exception on invalid pdf file' do
    assert_raises RuntimeError do
      @importer.send(:read_pdf_file, @permanent_test_files.join('not_a_pdf.pdf'))
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ndr_import-4.1.4 test/helpers/file/pdf_test.rb
ndr_import-4.1.3 test/helpers/file/pdf_test.rb
ndr_import-4.1.2 test/helpers/file/pdf_test.rb
ndr_import-4.1.1 test/helpers/file/pdf_test.rb
ndr_import-4.1.0 test/helpers/file/pdf_test.rb
ndr_import-4.0.1 test/helpers/file/pdf_test.rb
ndr_import-4.0.0 test/helpers/file/pdf_test.rb
ndr_import-3.1.6 test/helpers/file/pdf_test.rb
ndr_import-3.1.5 test/helpers/file/pdf_test.rb
ndr_import-3.1.4 test/helpers/file/pdf_test.rb
ndr_import-3.1.3 test/helpers/file/pdf_test.rb
ndr_import-3.1.2 test/helpers/file/pdf_test.rb
ndr_import-3.1.1 test/helpers/file/pdf_test.rb
ndr_import-3.1.0 test/helpers/file/pdf_test.rb
ndr_import-3.0.1 test/helpers/file/pdf_test.rb
ndr_import-3.0.0 test/helpers/file/pdf_test.rb