Skip to content
This repository was archived by the owner on Jul 14, 2024. It is now read-only.

Commit 548da9f

Browse files
Rubocop, RSpec, and deprecation warning for serialize method
1 parent 128aa4c commit 548da9f

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

app/models/pipeline_job.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class PipelineJob < ApplicationRecord
44
include Job
55

6-
serialize :harvest_definitions_to_run, Array
6+
serialize :harvest_definitions_to_run, type: Array
77

88
belongs_to :pipeline
99
belongs_to :extraction_job, optional: true

app/models/schedule.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Schedule < ApplicationRecord
55
belongs_to :destination
66
has_many :pipeline_jobs, dependent: :nullify
77

8-
serialize :harvest_definitions_to_run, Array
8+
serialize :harvest_definitions_to_run, type: Array
99

1010
validates :name, presence: true, uniqueness: true
1111
validates :frequency, presence: true

app/supplejack/extraction/documents.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def in_bounds?(current_page)
3333
end
3434

3535
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
3838
end
3939
end
4040
end

spec/sidekiq/text_extraction_worker_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
describe "#perform" do
1111
context 'when the PDF extraction is not part of a harvest' do
1212
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")
1414
end
1515

1616
it 'converts a PDF into raw text' do
@@ -36,7 +36,7 @@
3636
it 'names the new files following as it was originally' do
3737
TextExtractionWorker.new.perform(extraction_job.id)
3838

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)
4040
end
4141

4242
it 'does not enqueue Transformation Workers' do
@@ -48,7 +48,7 @@
4848

4949
context 'when the PDF extraction is part of a harvest' do
5050
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")
5252
end
5353

5454
let!(:harvest_report) { create(:harvest_report, pipeline_job:, harvest_job:) }
@@ -77,7 +77,7 @@
7777

7878
context 'when the PDF extraction is part of an enrichment' do
7979
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")
8181
end
8282

8383
let(:destination) { create(:destination) }

0 commit comments

Comments
 (0)