Sha256: 301f60ef4a720194f32c41fcba84a72885be3951b3c809e583e0a0fd3d1e75ee

Contents?: true

Size: 822 Bytes

Versions: 9

Compression:

Stored size: 822 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

9 entries across 9 versions & 1 rubygems

Version Path
ndr_import-6.4.1 test/helpers/file/pdf_test.rb
ndr_import-6.4.0 test/helpers/file/pdf_test.rb
ndr_import-6.3.0 test/helpers/file/pdf_test.rb
ndr_import-6.2.0 test/helpers/file/pdf_test.rb
ndr_import-6.1.1 test/helpers/file/pdf_test.rb
ndr_import-6.1.0 test/helpers/file/pdf_test.rb
ndr_import-6.0.0 test/helpers/file/pdf_test.rb
ndr_import-5.1.0 test/helpers/file/pdf_test.rb
ndr_import-5.0.0 test/helpers/file/pdf_test.rb