Sha256: a3f89d9305ba4cc050a50c1848de25a5aa343db294a79e67da61f55028b27fb5

Contents?: true

Size: 915 Bytes

Versions: 7

Compression:

Stored size: 915 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 ['Hello                                         World', '',
                  'Goodbye                                       Universe'], file_content
  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

7 entries across 7 versions & 1 rubygems

Version Path
ndr_import-8.5.0 test/helpers/file/pdf_test.rb
ndr_import-8.4.0 test/helpers/file/pdf_test.rb
ndr_import-8.3.0 test/helpers/file/pdf_test.rb
ndr_import-8.2.0 test/helpers/file/pdf_test.rb
ndr_import-8.1.0 test/helpers/file/pdf_test.rb
ndr_import-8.0.0 test/helpers/file/pdf_test.rb
ndr_import-7.0.0 test/helpers/file/pdf_test.rb