|
5 | 5 | RSpec.describe Ingestions::PostProcessors::SetStartSection do |
6 | 6 | include TestHelpers::IngestionHelper |
7 | 7 |
|
| 8 | + let_it_be(:project, refind: true) { FactoryBot.create :project } |
| 9 | + let_it_be(:creator, refind: true) { FactoryBot.create :user } |
| 10 | + |
8 | 11 | shared_examples_for "the start section assignment" do |section_name| |
9 | | - before { described_class.run(manifest: manifest, text: text, context: context) } |
| 12 | + it "determines the start_text_section_id", retry: 5 do |
| 13 | + expect do |
| 14 | + described_class.run!(manifest:, text:, context:) |
| 15 | + end.to execute_safely |
10 | 16 |
|
11 | | - it "determines the start_text_section_id" do |
12 | 17 | expect(text.start_text_section).not_to be_nil |
13 | 18 | expect(text.start_text_section.name).to eq section_name |
14 | 19 | end |
15 | 20 | end |
16 | 21 |
|
17 | 22 | context "when manifest" do |
18 | | - let!(:ingestion) { FactoryBot.create :ingestion, :uningested, :file_source, source_path: path } |
| 23 | + let!(:ingestion) { FactoryBot.create :ingestion, :uningested, :file_source, project:, creator:, source_path: path } |
| 24 | + |
19 | 25 | let(:context) { create_context(ingestion) } |
| 26 | + |
20 | 27 | let(:manifest) do |
21 | | - manifest = Ingestions::Strategies::Manifest.run(context: context).result |
22 | | - manifest = Ingestions::PreProcessor.run(context: context, manifest: manifest).result |
23 | | - manifest |
| 28 | + Ingestions::Strategies::Manifest.run!(context:).then do |manifest| |
| 29 | + Ingestions::PreProcessor.run!(context:, manifest:) |
| 30 | + end |
24 | 31 | end |
25 | | - let!(:text) { Ingestions::Compiler.run(manifest: manifest, context: context).result } |
| 32 | + |
| 33 | + let!(:text) { Ingestions::Compiler.run!(manifest:, context:) } |
26 | 34 |
|
27 | 35 | context "when starting section source is referenced multiple times" do |
28 | 36 | let(:path) { Rails.root.join("spec", "data", "ingestion", "manifest", "all_local.zip") } |
|
38 | 46 | end |
39 | 47 |
|
40 | 48 | context "when epub" do |
41 | | - let!(:ingestion) { FactoryBot.create :ingestion, :uningested, :file_source, source_path: path } |
| 49 | + let!(:ingestion) { FactoryBot.create :ingestion, :uningested, :file_source, project:, creator:, source_path: path } |
| 50 | + |
42 | 51 | let(:context) { create_context(ingestion) } |
| 52 | + |
43 | 53 | let(:manifest) do |
44 | | - manifest = Ingestions::Strategies::Epub.run(context: context).result |
45 | | - manifest = Ingestions::PreProcessor.run(context: context, manifest: manifest).result |
46 | | - manifest |
| 54 | + Ingestions::Strategies::Epub.run!(context:).then do |manifest| |
| 55 | + Ingestions::PreProcessor.run!(context:, manifest:) |
| 56 | + end |
47 | 57 | end |
| 58 | + |
48 | 59 | let!(:text) { Ingestions::Compiler.run(manifest: manifest, context: context).result } |
49 | 60 |
|
50 | 61 | context "when V2" do |
|
0 commit comments