Skip to content

Commit

Permalink
WIP - stash commit
Browse files Browse the repository at this point in the history
  • Loading branch information
afred committed Nov 6, 2024
1 parent 72850e1 commit a709152
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def asset_resource
end

def asset_resource_id
require 'pry-byebug'; binding.pry
pbcore.identifiers.detect{|id| id.source == 'http://americanarchiveinventory.org' }&.value
end

Expand Down Expand Up @@ -77,7 +76,6 @@ def ingest_klass(klass, attrs)
)
.call(cx)

require 'pry'; binding.pry
Hyrax::Transactions::Container["work_resource.create_with_bulk_behavior"]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,39 @@
# PBCoreXMLItemIngester (normal ingest), and then ingesting the 2nd with the
# class under test: PBCoreXMLInstantiationResetIngester.
let(:pbcore_docs) do
build_list(
:pbcore_description_document,
2,
:full_aapb,
identifiers: [ pbcore_identifier ],
instantiations: [
build_list(
:pbcore_instantiation,
# Random number of DIGITAL instantiations
rand(1..3),
:digital,
# Because we are ingesting we should not have an AAPB ID identifier,
# which means we have to explicitly specify our identifiers because an
# AAPB ID in in factory-generated instantiations added by default.
identifiers: [ build(:pbcore_instantiation_identifier) ]
),
build_list(
:pbcore_instantiation,
# Random number of PHYSICAL instantiations
rand(1..3),
:physical,
# Because we are ingesting we should not have an AAPB ID identifier,
# which means we have to explicitly specify our identifiers because an
# AAPB ID in in factory-generated instantiations added by default.
identifiers: [ build(:pbcore_instantiation_identifier) ]
)
# Flatten the 2 lists of instantiations into a single list.
].flatten
)
Array.new(2) do
build(
:pbcore_description_document,
:full_aapb,
identifiers: [ pbcore_identifier ],
instantiations: [
# Random number (1-3) of digital instantiations
Array.new(rand(1..3)) do
build(
:pbcore_instantiation,
:digital,
# Because we are ingesting we should not have an AAPB ID identifier,
# which means we have to explicitly specify our identifiers because an
# AAPB ID in in factory-generated instantiations added by default.
identifiers: [ build(:pbcore_instantiation_identifier) ]
)
end,

# Random number (1-3) of physical instantiations
Array.new(rand(1..3)) do
build(
:pbcore_instantiation,
:physical,
# Because we are ingesting we should not have an AAPB ID identifier,
# which means we have to explicitly specify our identifiers because an
# AAPB ID in in factory-generated instantiations added by default.
identifiers: [ build(:pbcore_instantiation_identifier) ]
)
end
# Flatten the 2 lists of instantiations into a single list.
].flatten
)
end
end

# Build 2 BatchItems from the 2 tempfiles containing the factory-generated PBCore
Expand Down Expand Up @@ -101,16 +105,15 @@
# 1. ingest batch_item_1 with PBCoreXMLItemIngester
# 2. ingest batch_item_2 with PBCoreXMLInstantiationResetIngester
before do

require 'pry'; binding.pry

AAPB::BatchIngest::PBCoreXMLItemIngester.new(batch_items.first).ingest
# Fetch the AssetResource as it was first ingested. This represents an
# "original" state of an AssetResource prior to running the
# PBCoreXMLInstantiationReset ingester, which we can use for comparison
@orig_asset_resource = AssetResource.find(pbcore_identifier.value).dup
AAPB::BatchIngest::PBCoreXMLInstantiationReset.new(batch_items.last).ingest
end

describe '#ingest' do

subject { described_class.new(batch_items.last).ingest }

context 'when the Asset is not in AMS' do
Expand Down

0 comments on commit a709152

Please sign in to comment.