This repository was archived by the owner on Jul 14, 2024. It is now read-only.
File tree 4 files changed +8
-8
lines changed
4 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 3
3
class PipelineJob < ApplicationRecord
4
4
include Job
5
5
6
- serialize :harvest_definitions_to_run , Array
6
+ serialize :harvest_definitions_to_run , type : Array
7
7
8
8
belongs_to :pipeline
9
9
belongs_to :extraction_job , optional : true
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ class Schedule < ApplicationRecord
5
5
belongs_to :destination
6
6
has_many :pipeline_jobs , dependent : :nullify
7
7
8
- serialize :harvest_definitions_to_run , Array
8
+ serialize :harvest_definitions_to_run , type : Array
9
9
10
10
validates :name , presence : true , uniqueness : true
11
11
validates :frequency , presence : true
Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ def in_bounds?(current_page)
33
33
end
34
34
35
35
def documents_filepath
36
- @documents_filepath ||= Dir . glob ( "#{ @folder } /*.json" ) . sort_by do |page |
37
- page . match ( /__(?<record_id>.+)__(?<page>.+).json/ ) [ :page ] . to_i
36
+ @documents_filepath ||= Dir . glob ( "#{ @folder } /*.json" ) . sort_by do |page |
37
+ page . match ( /__(?<record_id>.+)__(?<page>.+).json/ ) [ :page ] . to_i
38
38
end
39
39
end
40
40
end
Original file line number Diff line number Diff line change 10
10
describe "#perform" do
11
11
context 'when the PDF extraction is not part of a harvest' do
12
12
before do
13
- FileUtils . cp ( "#{ Rails . root } /spec/support/example.pdf" , "#{ extraction_job . extraction_folder } /example .json" )
13
+ FileUtils . cp ( "#{ Rails . root } /spec/support/example.pdf" , "#{ extraction_job . extraction_folder } /example__1234__01 .json" )
14
14
end
15
15
16
16
it 'converts a PDF into raw text' do
36
36
it 'names the new files following as it was originally' do
37
37
TextExtractionWorker . new . perform ( extraction_job . id )
38
38
39
- expect ( File . exist? ( "#{ extraction_job . extraction_folder } /example .json" ) ) . to eq ( true )
39
+ expect ( File . exist? ( "#{ extraction_job . extraction_folder } /example__1234__01 .json" ) ) . to eq ( true )
40
40
end
41
41
42
42
it 'does not enqueue Transformation Workers' do
48
48
49
49
context 'when the PDF extraction is part of a harvest' do
50
50
before do
51
- FileUtils . cp ( "#{ Rails . root } /spec/support/example.pdf" , "#{ extraction_job . extraction_folder } /example .json" )
51
+ FileUtils . cp ( "#{ Rails . root } /spec/support/example.pdf" , "#{ extraction_job . extraction_folder } /example__1234__01 .json" )
52
52
end
53
53
54
54
let! ( :harvest_report ) { create ( :harvest_report , pipeline_job :, harvest_job :) }
77
77
78
78
context 'when the PDF extraction is part of an enrichment' do
79
79
before do
80
- FileUtils . cp ( "#{ Rails . root } /spec/support/example.pdf" , "#{ extraction_job . extraction_folder } /example__1234__ .json" )
80
+ FileUtils . cp ( "#{ Rails . root } /spec/support/example.pdf" , "#{ extraction_job . extraction_folder } /example__1234__01 .json" )
81
81
end
82
82
83
83
let ( :destination ) { create ( :destination ) }
You can’t perform that action at this time.
0 commit comments