Skip to content

Commit c95f455

Browse files
♻️ harmonize test structure with other libraries (#214)
1 parent 524158f commit c95f455

File tree

76 files changed

+264
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+264
-240
lines changed

.github/workflows/_test-units.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ jobs:
4242
4343
- name: Install Ghostscript and ImageMagick on macOS
4444
if: runner.os == 'macOS'
45-
run: brew install ghostscript imagemagick
45+
run: |
46+
brew install ghostscript imagemagick
47+
/usr/bin/security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain
4648
- name: Change ImageMagick security policy on Ubuntu
4749
if: runner.os == 'Linux'
4850
run: |

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ end
2323
desc 'Run integration tests'
2424
RSpec::Core::RakeTask.new(:integration) do |t|
2525
t.pattern = 'spec/**/*_integration.rb'
26+
t.rspec_opts = ['--require', 'integration_helper']
2627
end
2728

2829
Rake::Task[:doc].enhance do

lib/mindee/http/endpoint.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
require_relative 'response_validation'
88

99
module Mindee
10+
# Mindee internal HTTP module.
1011
module HTTP
1112
# API key's default environment key name.
1213
API_KEY_ENV_NAME = 'MINDEE_API_KEY'

mindee.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
3333
spec.add_dependency 'origamindee', '~> 4.0'
3434
spec.add_dependency 'pdf-reader', '~> 2.14'
3535

36+
spec.add_development_dependency 'openssl', '~> 3.3.2'
3637
spec.add_development_dependency 'prism', '~> 1.3'
3738
spec.add_development_dependency 'rake', '~> 13.2'
3839
spec.add_development_dependency 'rbs', '~> 3.6'

sig/mindee/http/endpoint.rbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module Mindee
2323
def document_queue_req_post: (Input::Source::LocalInputSource | Input::Source::URLInputSource, ParseOptions) -> Net::HTTPResponse
2424
def document_queue_req_get: (String) -> Net::HTTPResponse
2525
def check_api_key: -> void
26+
def configure_ssl: (Net::HTTP) -> void
2627
end
2728
end
2829
end

spec/data

Submodule data updated 325 files

spec/data.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# frozen_string_literal: true
22

3-
DATA_DIR = File.join(__dir__, 'data').freeze
3+
ROOT_DATA_DIR = File.join(__dir__, 'data').freeze
4+
FILE_TYPES_DIR = File.join(ROOT_DATA_DIR, 'file_types').freeze
5+
V1_DATA_DIR = File.join(ROOT_DATA_DIR, 'v1').freeze
6+
V2_DATA_DIR = File.join(ROOT_DATA_DIR, 'v2').freeze
7+
V1_ASYNC_DIR = File.join(V1_DATA_DIR, 'async').freeze
8+
V1_PRODUCT_DATA_DIR = File.join(V1_DATA_DIR, 'products').freeze
9+
V1_OCR_DIR = File.join(V1_DATA_DIR, 'extras', 'ocr')
410

511
def load_json(dir_path, file_name)
612
file_data = File.read(File.join(dir_path, file_name))

spec/extras/extras_utils.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.

spec/image/extracted_image_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88

99
describe Mindee::Image::ExtractedImage do
1010
let(:file_path) do
11-
File.join(DATA_DIR, 'products', 'invoices', 'default_sample.jpg')
11+
File.join(V1_DATA_DIR, 'products', 'invoices', 'default_sample.jpg')
1212
end
1313
let(:input_source) do
1414
Mindee::Input::Source::PathInputSource.new(file_path)
1515
end
1616
let(:page_id) { 1 }
1717
let(:element_id) { 42 }
18-
let(:output_dir) { "#{DATA_DIR}/output" }
18+
let(:output_dir) { "#{ROOT_DATA_DIR}/output" }
1919

2020
describe '#initialize' do
2121
it 'initializes with correct attributes' do

spec/image/image_compressor_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
describe Mindee::Image::ImageCompressor do
88
describe 'Image Quality Compression' do
9-
let(:input_receipt_path) { "#{DATA_DIR}/file_types/receipt.jpg" }
10-
let(:output_dir) { "#{DATA_DIR}/output/" }
9+
let(:input_receipt_path) { "#{FILE_TYPES_DIR}/receipt.jpg" }
10+
let(:output_dir) { "#{ROOT_DATA_DIR}/output/" }
1111

1212
it 'should compress the image from input source' do
1313
receipt_input = Mindee::Input::Source::PathInputSource.new(input_receipt_path)

0 commit comments

Comments
 (0)