hydra-pcdm 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +38 -0
- data/Gemfile +6 -3
- data/README.md +31 -38
- data/Rakefile +14 -4
- data/hydra-pcdm.gemspec +10 -10
- data/lib/hydra/pcdm.rb +13 -12
- data/lib/hydra/pcdm/collection_indexer.rb +2 -4
- data/lib/hydra/pcdm/deep_member_iterator.rb +1 -1
- data/lib/hydra/pcdm/models/collection.rb +0 -1
- data/lib/hydra/pcdm/models/concerns/collection_behavior.rb +18 -5
- data/lib/hydra/pcdm/models/concerns/object_behavior.rb +13 -17
- data/lib/hydra/pcdm/models/concerns/pcdm_behavior.rb +50 -9
- data/lib/hydra/pcdm/models/file.rb +7 -7
- data/lib/hydra/pcdm/models/object.rb +0 -1
- data/lib/hydra/pcdm/object_indexer.rb +1 -2
- data/lib/hydra/pcdm/services/file/add_type.rb +1 -3
- data/lib/hydra/pcdm/services/file/get_mime_type.rb +2 -4
- data/lib/hydra/pcdm/validators/ancestor_validator.rb +3 -11
- data/lib/hydra/pcdm/validators/pcdm_object_validator.rb +2 -2
- data/lib/hydra/pcdm/validators/pcdm_validator.rb +2 -2
- data/lib/hydra/pcdm/version.rb +1 -1
- data/lib/hydra/pcdm/vocab/pcdm_terms.rb +81 -80
- data/lib/hydra/pcdm/vocab/sweet_jpl_terms.rb +12 -0
- data/spec/hydra/pcdm/ancestor_checker_spec.rb +7 -7
- data/spec/hydra/pcdm/collection_indexer_spec.rb +12 -13
- data/spec/hydra/pcdm/deep_member_iterator_spec.rb +16 -16
- data/spec/hydra/pcdm/models/collection_spec.rb +375 -313
- data/spec/hydra/pcdm/models/file_spec.rb +38 -38
- data/spec/hydra/pcdm/models/object_spec.rb +270 -256
- data/spec/hydra/pcdm/object_indexer_spec.rb +4 -4
- data/spec/hydra/pcdm/services/file/get_mime_type_spec.rb +10 -12
- data/spec/hydra/pcdm_spec.rb +21 -26
- metadata +19 -5
- data/lib/hydra/pcdm/vocab/ebucore_terms.rb +0 -33
- data/lib/hydra/pcdm/vocab/sweetjpl_terms.rb +0 -10
@@ -2,14 +2,14 @@ module Hydra::PCDM
|
|
2
2
|
module PcdmBehavior
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
included do
|
5
|
-
aggregates :members, predicate:
|
6
|
-
|
7
|
-
|
8
|
-
filters_association :members, as: :
|
5
|
+
aggregates :members, predicate: Vocab::PCDMTerms.hasMember,
|
6
|
+
class_name: 'ActiveFedora::Base',
|
7
|
+
type_validator: type_validator
|
8
|
+
filters_association :members, as: :objects, condition: :pcdm_object?
|
9
9
|
indirectly_contains :related_objects, has_member_relation: RDF::Vocab::ORE.aggregates,
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
inserted_content_relation: RDF::Vocab::ORE.proxyFor, class_name: 'ActiveFedora::Base',
|
11
|
+
through: 'ActiveFedora::Aggregation::Proxy', foreign_key: :target,
|
12
|
+
type_validator: Validators::PCDMObjectValidator
|
13
13
|
end
|
14
14
|
|
15
15
|
module ClassMethods
|
@@ -22,13 +22,54 @@ module Hydra::PCDM
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def member_of
|
26
26
|
aggregated_by
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def parents
|
30
|
+
warn '[DEPRECATION] `parents` is deprecated in Hydra::PCDM. Please use `member_of` instead. This has a target date for removal of 10-31-2015'
|
31
|
+
member_of
|
32
|
+
end
|
33
|
+
|
34
|
+
def in_collections
|
30
35
|
aggregated_by.select(&:pcdm_collection?)
|
31
36
|
end
|
32
37
|
|
38
|
+
def parent_collections
|
39
|
+
warn '[DEPRECATION] `parent_collections` is deprecated in Hydra::PCDM. Please use `in_collections` instead. This has a target date for removal of 10-31-2015'
|
40
|
+
in_collections
|
41
|
+
end
|
42
|
+
|
43
|
+
def in_collection_ids
|
44
|
+
in_collections.map(&:id)
|
45
|
+
end
|
46
|
+
|
47
|
+
def parent_collection_ids
|
48
|
+
warn '[DEPRECATION] `parent_collection_ids` is deprecated in Hydra::PCDM. Please use `in_collection_ids` instead. This has a target date for removal of 10-31-2015'
|
49
|
+
in_collection_ids
|
50
|
+
end
|
51
|
+
|
52
|
+
def ancestor?(record)
|
53
|
+
ancestor_checker.ancestor?(record)
|
54
|
+
end
|
55
|
+
|
56
|
+
def ancestor_checker
|
57
|
+
@ancestor_checker ||= ::Hydra::PCDM::AncestorChecker.new(self)
|
58
|
+
end
|
59
|
+
|
60
|
+
def child_objects
|
61
|
+
warn '[DEPRECATION] `child_objects` is deprecated in Hydra::PCDM. Please use `objects` instead. This has a target date for removal of 10-31-2015'
|
62
|
+
objects
|
63
|
+
end
|
64
|
+
|
65
|
+
def child_objects=(new_objects)
|
66
|
+
warn '[DEPRECATION] `child_objects=` is deprecated in Hydra::PCDM. Please use `objects=` instead. This has a target date for removal of 10-31-2015'
|
67
|
+
self.objects = new_objects
|
68
|
+
end
|
69
|
+
|
70
|
+
def child_object_ids
|
71
|
+
warn '[DEPRECATION] `child_object_ids` is deprecated in Hydra::PCDM. Please use `object_ids` instead. This has a target date for removal of 10-31-2015'
|
72
|
+
object_ids
|
73
|
+
end
|
33
74
|
end
|
34
75
|
end
|
@@ -3,15 +3,15 @@ module Hydra::PCDM
|
|
3
3
|
include ActiveFedora::WithMetadata
|
4
4
|
|
5
5
|
metadata do
|
6
|
-
configure type:
|
6
|
+
configure type: Vocab::PCDMTerms.File
|
7
7
|
property :label, predicate: ::RDF::RDFS.label
|
8
8
|
|
9
|
-
property :file_name, predicate:
|
10
|
-
property :file_size, predicate:
|
11
|
-
property :date_created, predicate:
|
12
|
-
property :has_mime_type, predicate:
|
13
|
-
property :date_modified, predicate:
|
14
|
-
property :byte_order, predicate:
|
9
|
+
property :file_name, predicate: RDF::Vocab::EBUCore.filename
|
10
|
+
property :file_size, predicate: RDF::Vocab::EBUCore.fileSize
|
11
|
+
property :date_created, predicate: RDF::Vocab::EBUCore.dateCreated
|
12
|
+
property :has_mime_type, predicate: RDF::Vocab::EBUCore.hasMimeType
|
13
|
+
property :date_modified, predicate: RDF::Vocab::EBUCore.dateModified
|
14
|
+
property :byte_order, predicate: Vocab::SweetJPLTerms.byteOrder
|
15
15
|
|
16
16
|
# This is a server-managed predicate which means Fedora does not let us change it.
|
17
17
|
property :file_hash, predicate: RDF::Vocab::PREMIS.hasMessageDigest
|
@@ -2,9 +2,8 @@ module Hydra::PCDM
|
|
2
2
|
class ObjectIndexer < ActiveFedora::IndexingService
|
3
3
|
def generate_solr_document
|
4
4
|
super.tap do |solr_doc|
|
5
|
-
solr_doc[
|
5
|
+
solr_doc['object_ids_ssim'] = object.object_ids
|
6
6
|
end
|
7
7
|
end
|
8
|
-
|
9
8
|
end
|
10
9
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Hydra::PCDM
|
2
2
|
class AddTypeToFile
|
3
|
-
|
4
3
|
# This adds an additional RDF type to an exsiting Hydra::PCDM::File
|
5
4
|
#
|
6
5
|
# @param [Hydra::PCDM::File] the file object you want to add it to
|
@@ -12,9 +11,8 @@ module Hydra::PCDM
|
|
12
11
|
t = file.metadata_node.get_values(:type)
|
13
12
|
return file if t.include?(uri)
|
14
13
|
t << uri
|
15
|
-
file.metadata_node.set_value(:type,t)
|
14
|
+
file.metadata_node.set_value(:type, t)
|
16
15
|
file
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
20
18
|
end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module Hydra::PCDM
|
2
2
|
class GetMimeTypeForFile
|
3
|
-
|
4
3
|
def self.call(path)
|
5
|
-
|
4
|
+
fail ArgumentError, 'supplied argument should be a path to a file' unless path.is_a?(String)
|
6
5
|
mime_types = ::MIME::Types.of(::File.basename(path))
|
7
|
-
mime_types.empty? ?
|
6
|
+
mime_types.empty? ? 'application/octet-stream' : mime_types.first.content_type
|
8
7
|
end
|
9
|
-
|
10
8
|
end
|
11
9
|
end
|
@@ -1,26 +1,18 @@
|
|
1
1
|
module Hydra::PCDM::Validators
|
2
2
|
class AncestorValidator
|
3
|
-
def self.validate!(association,record)
|
3
|
+
def self.validate!(association, record)
|
4
4
|
new(association.owner, record).validate!
|
5
5
|
end
|
6
6
|
|
7
7
|
attr_reader :owner, :record
|
8
|
-
delegate :ancestor?, to: :ancestor_checker
|
9
8
|
def initialize(owner, record)
|
10
9
|
@owner = owner
|
11
10
|
@record = record
|
12
11
|
end
|
13
12
|
|
14
13
|
def validate!
|
15
|
-
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def ancestor_checker
|
23
|
-
@ancestor_checker ||= ::Hydra::PCDM::AncestorChecker.new(owner)
|
14
|
+
return unless owner.ancestor?(record)
|
15
|
+
fail ArgumentError, "#{record.class} with ID: #{record.id} failed to pass AncestorChecker validation"
|
24
16
|
end
|
25
17
|
end
|
26
18
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Hydra::PCDM::Validators
|
2
2
|
class PCDMObjectValidator
|
3
|
-
def self.validate!(
|
3
|
+
def self.validate!(_association, record)
|
4
4
|
unless record.try(:pcdm_object?)
|
5
|
-
|
5
|
+
fail ActiveFedora::AssociationTypeMismatch, "#{record} is not a PCDM object."
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Hydra::PCDM::Validators
|
2
2
|
class PCDMValidator
|
3
|
-
def self.validate!(
|
3
|
+
def self.validate!(_reflection, record)
|
4
4
|
if !record.try(:pcdm_object?) && !record.try(:pcdm_collection?)
|
5
|
-
|
5
|
+
fail ActiveFedora::AssociationTypeMismatch, "#{record} is not a PCDM object or collection."
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
data/lib/hydra/pcdm/version.rb
CHANGED
@@ -1,87 +1,88 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
# This file generated automatically using vocab-fetch from https://raw.githubusercontent.com/duraspace/pcdm/master/models.rdf
|
3
3
|
require 'rdf'
|
4
|
-
module
|
5
|
-
|
4
|
+
module Hydra::PCDM
|
5
|
+
module Vocab
|
6
|
+
class PCDMTerms < RDF::StrictVocabulary('http://pcdm.org/models#')
|
7
|
+
# Class definitions
|
8
|
+
term :AdministrativeSet,
|
9
|
+
comment: %(
|
10
|
+
An Administrative Set is a grouping of resources that an administrative unit is ultimately
|
11
|
+
responsible for managing. The set itself helps to manage the items within it. An Object
|
12
|
+
or Collection may be contained by only one AdministrativeSet.
|
13
|
+
).freeze,
|
14
|
+
label: 'Administrative Set'.freeze,
|
15
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
16
|
+
subClassOf: 'http://www.w3.org/ns/ldp#Container'.freeze,
|
17
|
+
type: 'rdfs:Class'.freeze
|
18
|
+
term :Collection,
|
19
|
+
comment: %(
|
20
|
+
A Collection is a group of resources. Collections have descriptive metadata, access metadata,
|
21
|
+
and may links to works and/or collections. By default, member works and collections are an
|
22
|
+
unordered set, but can be ordered using the ORE Proxy class.
|
23
|
+
).freeze,
|
24
|
+
label: 'Collection'.freeze,
|
25
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
26
|
+
subClassOf: 'http://www.openarchives.org/ore/terms/Aggregation'.freeze,
|
27
|
+
type: 'rdfs:Class'.freeze
|
28
|
+
term :File,
|
29
|
+
comment: %(
|
30
|
+
A File is a sequence of binary data and is described by some accompanying metadata.
|
31
|
+
The metadata typically includes at least basic technical metadata \(size, content type,
|
32
|
+
modification date, etc.\), but can also include properties related to preservation,
|
33
|
+
digitization process, provenance, etc. Files MUST be contained by exactly one Object.
|
34
|
+
).freeze,
|
35
|
+
label: 'File'.freeze,
|
36
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
37
|
+
type: 'rdfs:Class'.freeze
|
38
|
+
term :Object,
|
39
|
+
comment: %(
|
40
|
+
An Object is an intellectual entity, sometimes called a "work", "digital object", etc.
|
41
|
+
Objects have descriptive metadata, access metadata, may contain files and other Objects as
|
42
|
+
member "components". Each level of a work is therefore represented by an Object instance,
|
43
|
+
and is capable of standing on its own, being linked to from Collections and other Objects.
|
44
|
+
Member Objects can be ordered using the ORE Proxy class.
|
45
|
+
).freeze,
|
46
|
+
label: 'Object'.freeze,
|
47
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
48
|
+
subClassOf: 'http://www.openarchives.org/ore/terms/Aggregation'.freeze,
|
49
|
+
type: 'rdfs:Class'.freeze
|
6
50
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
modification date, etc.\), but can also include properties related to preservation,
|
33
|
-
digitization process, provenance, etc. Files MUST be contained by exactly one Object.
|
34
|
-
).freeze,
|
35
|
-
label: "File".freeze,
|
36
|
-
"rdfs:isDefinedBy" => %(http://pcdm.org/models#).freeze,
|
37
|
-
type: "rdfs:Class".freeze
|
38
|
-
term :Object,
|
39
|
-
comment: %(
|
40
|
-
An Object is an intellectual entity, sometimes called a "work", "digital object", etc.
|
41
|
-
Objects have descriptive metadata, access metadata, may contain files and other Objects as
|
42
|
-
member "components". Each level of a work is therefore represented by an Object instance,
|
43
|
-
and is capable of standing on its own, being linked to from Collections and other Objects.
|
44
|
-
Member Objects can be ordered using the ORE Proxy class.
|
45
|
-
).freeze,
|
46
|
-
label: "Object".freeze,
|
47
|
-
"rdfs:isDefinedBy" => %(http://pcdm.org/models#).freeze,
|
48
|
-
subClassOf: "http://www.openarchives.org/ore/terms/Aggregation".freeze,
|
49
|
-
type: "rdfs:Class".freeze
|
51
|
+
# Property definitions
|
52
|
+
property :hasFile,
|
53
|
+
comment: %(Links to a File contained by this Object.).freeze,
|
54
|
+
domain: 'http://pcdm.org/models#Object'.freeze,
|
55
|
+
label: 'has file'.freeze,
|
56
|
+
range: 'http://pcdm.org/models#File'.freeze,
|
57
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
58
|
+
subPropertyOf: 'http://www.w3.org/ns/ldp#contains'.freeze,
|
59
|
+
type: 'rdf:Property'.freeze
|
60
|
+
property :hasMember,
|
61
|
+
comment: %(Links to a related Object. Typically used to link to component parts, such as a book linking to a page.).freeze,
|
62
|
+
domain: 'http://www.openarchives.org/ore/terms/Aggregation'.freeze,
|
63
|
+
label: 'has member'.freeze,
|
64
|
+
range: 'http://www.openarchives.org/ore/terms/Aggregation'.freeze,
|
65
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
66
|
+
subPropertyOf: 'http://www.openarchives.org/ore/terms/aggregates'.freeze,
|
67
|
+
type: 'rdf:Property'.freeze
|
68
|
+
property :hasRelatedFile,
|
69
|
+
comment: %(Links to a File which is related to this Object but doesn't directly describe or represent it, such as technical metadata about other files.).freeze,
|
70
|
+
domain: 'http://pcdm.org/models#Object'.freeze,
|
71
|
+
label: 'has related file'.freeze,
|
72
|
+
range: 'http://pcdm.org/models#File'.freeze,
|
73
|
+
'rdfs:isDefinedBy' => %(http://pcdm.org/models#).freeze,
|
74
|
+
subPropertyOf: 'http://www.w3.org/ns/ldp#contains'.freeze,
|
75
|
+
type: 'rdf:Property'.freeze
|
50
76
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
comment: %(Links to a related Object. Typically used to link to component parts, such as a book linking to a page.).freeze,
|
62
|
-
domain: "http://www.openarchives.org/ore/terms/Aggregation".freeze,
|
63
|
-
label: "has member".freeze,
|
64
|
-
range: "http://www.openarchives.org/ore/terms/Aggregation".freeze,
|
65
|
-
"rdfs:isDefinedBy" => %(http://pcdm.org/models#).freeze,
|
66
|
-
subPropertyOf: "http://www.openarchives.org/ore/terms/aggregates".freeze,
|
67
|
-
type: "rdf:Property".freeze
|
68
|
-
property :hasRelatedFile,
|
69
|
-
comment: %(Links to a File which is related to this Object but doesn't directly describe or represent it, such as technical metadata about other files.).freeze,
|
70
|
-
domain: "http://pcdm.org/models#Object".freeze,
|
71
|
-
label: "has related file".freeze,
|
72
|
-
range: "http://pcdm.org/models#File".freeze,
|
73
|
-
"rdfs:isDefinedBy" => %(http://pcdm.org/models#).freeze,
|
74
|
-
subPropertyOf: "http://www.w3.org/ns/ldp#contains".freeze,
|
75
|
-
type: "rdf:Property".freeze
|
76
|
-
|
77
|
-
# Extra definitions
|
78
|
-
term :"",
|
79
|
-
comment: %(Ontology for the Portland Common Data Model, intended to underlie a wide array of repository and DAMS applications.).freeze,
|
80
|
-
"dc:modified" => %(2015-03-16).freeze,
|
81
|
-
"dc:publisher" => %(http://www.duraspace.org/).freeze,
|
82
|
-
"dc:title" => %(Portland Common Data Model).freeze,
|
83
|
-
label: "".freeze,
|
84
|
-
"owl:versionInfo" => %(2015/03/16).freeze,
|
85
|
-
"rdfs:seeAlso" => %(https://github.com/duraspace/pcdm/wiki).freeze
|
77
|
+
# Extra definitions
|
78
|
+
term :"",
|
79
|
+
comment: %(Ontology for the Portland Common Data Model, intended to underlie a wide array of repository and DAMS applications.).freeze,
|
80
|
+
'dc:modified' => %(2015-03-16).freeze,
|
81
|
+
'dc:publisher' => %(http://www.duraspace.org/).freeze,
|
82
|
+
'dc:title' => %(Portland Common Data Model).freeze,
|
83
|
+
label: ''.freeze,
|
84
|
+
'owl:versionInfo' => %(2015/03/16).freeze,
|
85
|
+
'rdfs:seeAlso' => %(https://github.com/duraspace/pcdm/wiki).freeze
|
86
|
+
end
|
86
87
|
end
|
87
88
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rdf'
|
2
|
+
module Hydra::PCDM
|
3
|
+
module Vocab
|
4
|
+
class SweetJPLTerms < RDF::StrictVocabulary('http://sweet.jpl.nasa.gov/2.2/reprDataFormat.owl#')
|
5
|
+
# Property definitions
|
6
|
+
property :byteOrder,
|
7
|
+
comment: ['Byte Order.'.freeze],
|
8
|
+
range: 'xsd:string'.freeze,
|
9
|
+
label: 'Byte Order'.freeze
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -3,25 +3,25 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe Hydra::PCDM::AncestorChecker do
|
4
4
|
subject { described_class.new(record) }
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe '#ancestor?' do
|
7
7
|
let(:record) { instance_double(Hydra::PCDM::Object) }
|
8
8
|
let(:member) { record }
|
9
9
|
let(:result) { subject.ancestor?(member) }
|
10
10
|
|
11
|
-
context
|
12
|
-
it
|
11
|
+
context 'when the member is the record itself' do
|
12
|
+
it 'is true' do
|
13
13
|
expect(result).to eq true
|
14
14
|
end
|
15
15
|
end
|
16
|
-
context
|
16
|
+
context 'when the member is not an ancestor' do
|
17
17
|
let(:member) { instance_double(Hydra::PCDM::Object, members: []) }
|
18
|
-
it
|
18
|
+
it 'is false' do
|
19
19
|
expect(result).to eq false
|
20
20
|
end
|
21
21
|
end
|
22
|
-
context
|
22
|
+
context 'when the member is an ancestor' do
|
23
23
|
let(:member) { instance_double(Hydra::PCDM::Object, members: [record]) }
|
24
|
-
it
|
24
|
+
it 'is true' do
|
25
25
|
expect(result).to eq true
|
26
26
|
end
|
27
27
|
end
|
@@ -1,26 +1,25 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Hydra::PCDM::CollectionIndexer do
|
4
|
-
let(:collection)
|
5
|
-
let(:
|
6
|
-
let(:
|
7
|
-
let(:member_ids) {
|
8
|
-
let(:indexer)
|
4
|
+
let(:collection) { Hydra::PCDM::Collection.new }
|
5
|
+
let(:collection_ids) { %w(123 456) }
|
6
|
+
let(:object_ids) { ['789'] }
|
7
|
+
let(:member_ids) { %w(123 456 789) }
|
8
|
+
let(:indexer) { described_class.new(collection) }
|
9
9
|
|
10
10
|
before do
|
11
|
-
allow(collection).to receive(:
|
12
|
-
allow(collection).to receive(:
|
11
|
+
allow(collection).to receive(:collection_ids).and_return(collection_ids)
|
12
|
+
allow(collection).to receive(:object_ids).and_return(object_ids)
|
13
13
|
allow(collection).to receive(:member_ids).and_return(member_ids)
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe '#generate_solr_document' do
|
17
17
|
subject { indexer.generate_solr_document }
|
18
18
|
|
19
|
-
it
|
20
|
-
expect(subject['
|
21
|
-
expect(subject['
|
22
|
-
expect(subject['member_ids_ssim']).to eq
|
19
|
+
it 'has fields' do
|
20
|
+
expect(subject['collection_ids_ssim']).to eq %w(123 456)
|
21
|
+
expect(subject['object_ids_ssim']).to eq ['789']
|
22
|
+
expect(subject['member_ids_ssim']).to eq %w(123 456 789)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|