Skip to content

Commit

Permalink
Get tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkadel committed Oct 5, 2021
1 parent b0efdcf commit 3961d4a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/zizia/record_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ def import(record:)
raise e
end

def import_all_records(records)
@collection_records = records.select { |record| record.object_type == "collection" }
@collection_records.each { |record| create_collection(record) }
@work_records = records.select { |record| record.object_type == "work" }
@file_records = records.select { |record| record.object_type == "file" }
@work_records.each { |record| import(record: record) }
end

def import_type(record)
raise 'No curation_concern found for import' unless
defined?(Hyrax) && Hyrax&.config&.curation_concerns&.any?
Expand Down
5 changes: 5 additions & 0 deletions spec/zizia/importer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def import(record:)
records << record.attributes
end

def import_all_records(records)
@work_records = records.select { |record| record.object_type == "work" }
@work_records.each { |record| import(record: record) }
end

def records
@records ||= []
end
Expand Down

0 comments on commit 3961d4a

Please sign in to comment.