active-fedora 9.13.0 → 10.0.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -19
- data/lib/active_fedora.rb +0 -17
- data/lib/active_fedora/associations.rb +0 -16
- data/lib/active_fedora/associations/builder/association.rb +3 -19
- data/lib/active_fedora/associations/builder/has_and_belongs_to_many.rb +1 -3
- data/lib/active_fedora/attached_files.rb +2 -108
- data/lib/active_fedora/attributes.rb +4 -100
- data/lib/active_fedora/core.rb +0 -6
- data/lib/active_fedora/datastreams.rb +0 -2
- data/lib/active_fedora/errors.rb +0 -9
- data/lib/active_fedora/file.rb +9 -22
- data/lib/active_fedora/file_configurator.rb +1 -32
- data/lib/active_fedora/identifiable.rb +0 -6
- data/lib/active_fedora/ldp_resource.rb +0 -12
- data/lib/active_fedora/qualified_dublin_core_datastream.rb +1 -1
- data/lib/active_fedora/query_result_builder.rb +0 -17
- data/lib/active_fedora/rdf/datastream_indexing.rb +0 -11
- data/lib/active_fedora/rdf/indexing_service.rb +1 -1
- data/lib/active_fedora/rdf/rdf_datastream.rb +0 -10
- data/lib/active_fedora/relation/finder_methods.rb +2 -21
- data/lib/active_fedora/solr_query_builder.rb +0 -16
- data/lib/active_fedora/solr_service.rb +2 -89
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/versionable.rb +0 -8
- data/spec/config_helper.rb +0 -4
- data/spec/integration/attached_files_spec.rb +1 -108
- data/spec/integration/attributes_spec.rb +14 -94
- data/spec/integration/direct_container_spec.rb +2 -2
- data/spec/integration/file_spec.rb +23 -13
- data/spec/integration/indexing_spec.rb +4 -4
- data/spec/integration/json_serialization_spec.rb +4 -57
- data/spec/integration/ntriples_datastream_spec.rb +77 -139
- data/spec/integration/relation_delegation_spec.rb +16 -18
- data/spec/integration/{model_spec.rb → scoping_spec.rb} +10 -14
- data/spec/integration/solr_hit_spec.rb +4 -20
- data/spec/integration/solr_instance_loader_spec.rb +1 -13
- data/spec/integration/versionable_spec.rb +0 -9
- data/spec/samples/models/mods_article.rb +1 -6
- data/spec/spec_helper.rb +0 -3
- data/spec/unit/attached_files_spec.rb +29 -127
- data/spec/unit/attributes_spec.rb +51 -475
- data/spec/unit/base_active_model_spec.rb +12 -47
- data/spec/unit/base_extra_spec.rb +1 -1
- data/spec/unit/code_configurator_spec.rb +2 -10
- data/spec/unit/core_spec.rb +3 -18
- data/spec/unit/file_configurator_spec.rb +0 -80
- data/spec/unit/file_spec.rb +0 -6
- data/spec/unit/has_and_belongs_to_many_association_spec.rb +0 -7
- data/spec/unit/inheritance_spec.rb +0 -12
- data/spec/unit/ntriples_datastream_spec.rb +2 -74
- data/spec/unit/property_spec.rb +0 -3
- data/spec/unit/query_spec.rb +0 -7
- data/spec/unit/querying_spec.rb +24 -0
- data/spec/unit/rdf/indexing_service_spec.rb +32 -20
- data/spec/unit/rdf_resource_datastream_spec.rb +37 -97
- data/spec/unit/solr_query_builder_spec.rb +0 -8
- data/spec/unit/solr_service_spec.rb +0 -13
- metadata +6 -19
- data/config/predicate_mappings.yml +0 -51
- data/lib/active_fedora/attributes/om_attribute.rb +0 -26
- data/lib/active_fedora/attributes/rdf_datastream_attribute.rb +0 -44
- data/lib/active_fedora/attributes/stream_attribute.rb +0 -43
- data/lib/active_fedora/datastream.rb +0 -9
- data/lib/active_fedora/model.rb +0 -31
- data/lib/active_fedora/predicates.rb +0 -122
- data/lib/active_fedora/simple_datastream.rb +0 -92
- data/spec/fixtures/rails_root/config/predicate_mappings.yml +0 -31
- data/spec/integration/field_to_solr_name_spec.rb +0 -36
- data/spec/unit/base_datastream_management_spec.rb +0 -19
- data/spec/unit/model_spec.rb +0 -30
- data/spec/unit/predicates_spec.rb +0 -126
- data/spec/unit/simple_datastream_spec.rb +0 -101
@@ -6,38 +6,21 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
6
6
|
property :size
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
index.as :stored_searchable, :sortable
|
17
|
-
end
|
18
|
-
property :filesize, predicate: FileVocabulary.size do |index|
|
19
|
-
index.type :integer
|
20
|
-
index.as :stored_sortable
|
21
|
-
end
|
22
|
-
property :part, predicate: ::RDF::Vocab::DC.hasPart
|
23
|
-
property :based_near, predicate: ::RDF::FOAF.based_near
|
24
|
-
property :related_url, predicate: ::RDF::RDFS.seeAlso
|
25
|
-
end
|
9
|
+
class MyDatastream < ActiveFedora::NtriplesRDFDatastream
|
10
|
+
property :title, predicate: ::RDF::Vocab::DC.title
|
11
|
+
property :date_uploaded, predicate: ::RDF::Vocab::DC.dateSubmitted
|
12
|
+
property :filesize, predicate: FileVocabulary.size
|
13
|
+
property :part, predicate: ::RDF::Vocab::DC.hasPart
|
14
|
+
property :based_near, predicate: ::RDF::FOAF.based_near
|
15
|
+
property :related_url, predicate: ::RDF::RDFS.seeAlso
|
26
16
|
end
|
27
17
|
|
28
18
|
class RdfTest < ActiveFedora::Base
|
29
19
|
has_subresource 'rdf', class_name: 'MyDatastream'
|
30
|
-
Deprecation.silence(ActiveFedora::Attributes) do
|
31
|
-
has_attributes :based_near, :related_url, :part, :date_uploaded, datastream: 'rdf', multiple: true
|
32
|
-
has_attributes :title, :filesize, datastream: 'rdf', multiple: false
|
33
|
-
end
|
34
20
|
end
|
35
|
-
@subject = RdfTest.new
|
36
21
|
end
|
37
22
|
|
38
|
-
subject {
|
39
|
-
@subject
|
40
|
-
}
|
23
|
+
subject { MyDatastream.new(described_class.id_to_uri('test:1')) }
|
41
24
|
|
42
25
|
after do
|
43
26
|
Object.send(:remove_const, :RdfTest)
|
@@ -45,10 +28,6 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
45
28
|
Object.send(:remove_const, :FileVocabulary)
|
46
29
|
end
|
47
30
|
|
48
|
-
it "does not try to send an empty datastream" do
|
49
|
-
@subject.save
|
50
|
-
end
|
51
|
-
|
52
31
|
let(:remote_content) do
|
53
32
|
<<EOF
|
54
33
|
<#{ActiveFedora.fedora.host}/test/test:1> <http://purl.org/dc/terms/created> "2010-12-31"^^<http://www.w3.org/2001/XMLSchema#date> .
|
@@ -60,109 +39,73 @@ describe ActiveFedora::NtriplesRDFDatastream do
|
|
60
39
|
EOF
|
61
40
|
end
|
62
41
|
|
63
|
-
it "saves content properly upon save" do
|
64
|
-
foo = RdfTest.new('test:1') # ID needs to match the subject in the loaded file
|
65
|
-
foo.title = 'Hamlet'
|
66
|
-
foo.save
|
67
|
-
expect(foo.title).to eq 'Hamlet'
|
68
|
-
foo.rdf.content = remote_content
|
69
|
-
foo.save
|
70
|
-
expect(foo.title).to eq 'Title of work'
|
71
|
-
end
|
72
|
-
|
73
42
|
it "delegates as_json to the fields" do
|
74
|
-
|
75
|
-
expect(
|
76
|
-
expect(
|
77
|
-
end
|
78
|
-
|
79
|
-
it "solrizes even when the object is not new" do
|
80
|
-
foo = RdfTest.new
|
81
|
-
expect(foo).to receive(:update_index).once
|
82
|
-
foo.title = "title1"
|
83
|
-
foo.save
|
84
|
-
foo = RdfTest.find(foo.id)
|
85
|
-
expect(foo).to receive(:update_index).once
|
86
|
-
foo.title = "The Work2"
|
87
|
-
foo.save
|
43
|
+
subject.title = "Title of work"
|
44
|
+
expect(subject.title.as_json).to eq ["Title of work"]
|
45
|
+
expect(subject.title.to_json).to eq "\[\"Title of work\"\]"
|
88
46
|
end
|
89
47
|
|
90
48
|
describe "serializing" do
|
91
49
|
it "handles dates" do
|
92
50
|
subject.date_uploaded = [Date.parse('2012-11-02')]
|
93
51
|
expect(subject.date_uploaded.first).to be_kind_of Date
|
94
|
-
solr_document = subject.to_solr
|
95
|
-
expect(solr_document[ActiveFedora.index_field_mapper.solr_name('rdf__date_uploaded', type: :date)]).to eq ['2012-11-02T00:00:00Z']
|
96
52
|
end
|
97
53
|
it "handles integers" do
|
98
54
|
subject.filesize = 12_345
|
99
|
-
expect(subject.filesize).to be_kind_of
|
100
|
-
|
101
|
-
expect(solr_document[ActiveFedora.index_field_mapper.solr_name('rdf__filesize', :stored_sortable, type: :integer)]).to eq '12345'
|
55
|
+
expect(subject.filesize).to be_kind_of Array
|
56
|
+
expect(subject.filesize.first).to be_kind_of Fixnum
|
102
57
|
end
|
103
58
|
end
|
104
59
|
|
105
|
-
it "produces a solr document" do
|
106
|
-
@subject = RdfTest.new(title: "War and Peace")
|
107
|
-
solr_document = @subject.to_solr
|
108
|
-
expect(solr_document[ActiveFedora.index_field_mapper.solr_name('rdf__title', :facetable)]).to eq ["War and Peace"]
|
109
|
-
expect(solr_document[ActiveFedora.index_field_mapper.solr_name('rdf__title', type: :string)]).to eq ["War and Peace"]
|
110
|
-
end
|
111
|
-
|
112
60
|
it "sets and recall values" do
|
113
|
-
|
114
|
-
expect(
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
expect(
|
120
|
-
expect(
|
121
|
-
expect(
|
122
|
-
expect(
|
123
|
-
end
|
124
|
-
|
125
|
-
it "set,
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
loaded =
|
133
|
-
expect(loaded.title).to eq 'War and Peace'
|
61
|
+
subject.title = 'War and Peace'
|
62
|
+
expect(subject).to be_changed
|
63
|
+
subject.based_near = ["Moscow, Russia"]
|
64
|
+
subject.related_url = ["http://en.wikipedia.org/wiki/War_and_Peace"]
|
65
|
+
subject.part = ["this is a part"]
|
66
|
+
subject.save
|
67
|
+
expect(subject.title).to eq ['War and Peace']
|
68
|
+
expect(subject.based_near).to eq ["Moscow, Russia"]
|
69
|
+
expect(subject.related_url).to eq ["http://en.wikipedia.org/wiki/War_and_Peace"]
|
70
|
+
expect(subject.part).to eq ["this is a part"]
|
71
|
+
end
|
72
|
+
|
73
|
+
it "set, persist, and recall values" do
|
74
|
+
subject.title = 'War and Peace'
|
75
|
+
subject.based_near = ["Moscow, Russia"]
|
76
|
+
subject.related_url = ["http://en.wikipedia.org/wiki/War_and_Peace"]
|
77
|
+
subject.part = ["this is a part"]
|
78
|
+
subject.save
|
79
|
+
|
80
|
+
loaded = MyDatastream.new(subject.uri)
|
81
|
+
expect(loaded.title).to eq ['War and Peace']
|
134
82
|
expect(loaded.based_near).to eq ['Moscow, Russia']
|
135
83
|
expect(loaded.related_url).to eq ['http://en.wikipedia.org/wiki/War_and_Peace']
|
136
84
|
expect(loaded.part).to eq ['this is a part']
|
137
85
|
end
|
138
86
|
|
139
87
|
it "sets multiple values" do
|
140
|
-
|
141
|
-
|
88
|
+
subject.part = ["part 1", "part 2"]
|
89
|
+
subject.save
|
142
90
|
|
143
|
-
loaded =
|
91
|
+
loaded = MyDatastream.new(subject.uri)
|
144
92
|
expect(loaded.part).to eq ['part 1', 'part 2']
|
145
93
|
end
|
146
94
|
|
147
95
|
it "appends values" do
|
148
|
-
|
149
|
-
|
96
|
+
subject.part = ["thing 1"]
|
97
|
+
subject.save
|
150
98
|
|
151
|
-
|
152
|
-
expect(
|
153
|
-
end
|
154
|
-
|
155
|
-
it "is able to save a blank document" do
|
156
|
-
@subject.title = ""
|
157
|
-
@subject.save
|
99
|
+
subject.part << "thing 2"
|
100
|
+
expect(subject.part).to eq ["thing 1", "thing 2"]
|
158
101
|
end
|
159
102
|
|
160
103
|
it "loads n-triples into the graph" do
|
161
104
|
ntrip = '<http://oregondigital.org/ns/62> <http://purl.org/dc/terms/type> "Image" .
|
162
105
|
<http://oregondigital.org/ns/62> <http://purl.org/dc/terms/spatial> "Benton County (Ore.)" .
|
163
106
|
'
|
164
|
-
|
165
|
-
expect(
|
107
|
+
subject.content = ntrip
|
108
|
+
expect(subject.graph.dump(:ntriples)).to eq ntrip
|
166
109
|
end
|
167
110
|
|
168
111
|
describe "using rdf_subject" do
|
@@ -190,76 +133,71 @@ EOF
|
|
190
133
|
end
|
191
134
|
|
192
135
|
it "deletes values" do
|
193
|
-
|
194
|
-
|
195
|
-
|
136
|
+
subject.title = "Hamlet"
|
137
|
+
subject.related_url = ["http://psu.edu/"]
|
138
|
+
subject.related_url << "http://projecthydra.org/"
|
196
139
|
|
197
|
-
expect(
|
198
|
-
expect(
|
199
|
-
expect(
|
140
|
+
expect(subject.title).to eq ["Hamlet"]
|
141
|
+
expect(subject.related_url).to include("http://psu.edu/")
|
142
|
+
expect(subject.related_url).to include("http://projecthydra.org/")
|
200
143
|
|
201
|
-
|
202
|
-
expect(
|
144
|
+
subject.title = "" # empty string can be meaningful, don't assume delete.
|
145
|
+
expect(subject.title).to eq ['']
|
203
146
|
|
204
|
-
|
205
|
-
|
147
|
+
subject.title = nil
|
148
|
+
subject.related_url.delete("http://projecthydra.org/")
|
206
149
|
|
207
|
-
expect(
|
208
|
-
expect(
|
150
|
+
expect(subject.title).to eq []
|
151
|
+
expect(subject.related_url).to eq ["http://psu.edu/"]
|
209
152
|
end
|
153
|
+
|
210
154
|
it "deletes multiple values at once" do
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
expect(
|
215
|
-
|
216
|
-
expect(
|
217
|
-
expect(
|
155
|
+
subject.part = ["MacBeth"]
|
156
|
+
subject.part << "Hamlet"
|
157
|
+
subject.part << "Romeo & Juliet"
|
158
|
+
expect(subject.part.first).to eq "MacBeth"
|
159
|
+
subject.part.delete("MacBeth", "Romeo & Juliet")
|
160
|
+
expect(subject.part).to eq ["Hamlet"]
|
161
|
+
expect(subject.part.first).to eq "Hamlet"
|
218
162
|
end
|
219
163
|
it "ignores values to be deleted that do not exist" do
|
220
|
-
|
221
|
-
|
222
|
-
expect(
|
164
|
+
subject.part = ["title1", "title2", "title3"]
|
165
|
+
subject.part.delete("title2", "title4", "title6")
|
166
|
+
expect(subject.part).to eq ["title1", "title3"]
|
223
167
|
end
|
168
|
+
|
224
169
|
describe "term proxy methods" do
|
225
170
|
before(:each) do
|
226
171
|
class TitleDatastream < ActiveFedora::NtriplesRDFDatastream
|
227
172
|
property :title, predicate: ::RDF::Vocab::DC.title
|
228
173
|
end
|
229
|
-
class Foobar < ActiveFedora::Base
|
230
|
-
has_subresource 'rdf', class_name: 'TitleDatastream'
|
231
|
-
Deprecation.silence(ActiveFedora::Attributes) do
|
232
|
-
has_attributes :title, datastream: 'rdf', multiple: true
|
233
|
-
end
|
234
|
-
end
|
235
|
-
@subject = Foobar.new
|
236
|
-
@subject.title = ["title1", "title2", "title3"]
|
237
174
|
end
|
175
|
+
subject { TitleDatastream.new }
|
176
|
+
before { subject.title = ["title1", "title2", "title3"] }
|
238
177
|
|
239
178
|
after(:each) do
|
240
|
-
Object.send(:remove_const, :Foobar)
|
241
179
|
Object.send(:remove_const, :TitleDatastream)
|
242
180
|
end
|
243
181
|
|
244
182
|
it "supports the count method to determine # of values" do
|
245
|
-
expect(
|
183
|
+
expect(subject.title.count).to eq 3
|
246
184
|
end
|
247
185
|
it "iterates over multiple values" do
|
248
|
-
expect(
|
186
|
+
expect(subject.title).to respond_to(:each)
|
249
187
|
end
|
250
188
|
it "gets the first value" do
|
251
|
-
expect(
|
189
|
+
expect(subject.title.first).to eq "title1"
|
252
190
|
end
|
253
191
|
it "evaluates equality predictably" do
|
254
|
-
expect(
|
192
|
+
expect(subject.title).to eq ["title1", "title2", "title3"]
|
255
193
|
end
|
256
194
|
it "supports the empty? method" do
|
257
|
-
expect(
|
258
|
-
|
259
|
-
expect(
|
195
|
+
expect(subject.title).to_not be_empty
|
196
|
+
subject.title.delete("title1", "title2", "title3")
|
197
|
+
expect(subject.title).to be_empty
|
260
198
|
end
|
261
199
|
it "supports the is_a? method" do
|
262
|
-
expect(
|
200
|
+
expect(subject.title.is_a?(Array)).to eq true
|
263
201
|
end
|
264
202
|
end
|
265
203
|
end
|
@@ -1,33 +1,31 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe ActiveFedora::
|
3
|
+
describe ActiveFedora::Base do
|
4
4
|
before(:all) do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
doc
|
16
|
-
end
|
5
|
+
class TestClass < ActiveFedora::Base
|
6
|
+
property :foo, predicate: ::RDF::URI('http://example.com/foo')
|
7
|
+
property :bar, predicate: ::RDF::URI('http://example.com/bar') do |index|
|
8
|
+
index.as :stored_searchable
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_solr(doc = {})
|
12
|
+
doc = super
|
13
|
+
doc[ActiveFedora.index_field_mapper.solr_name('foo', :sortable)] = doc[ActiveFedora.index_field_mapper.solr_name('foo', type: :string)]
|
14
|
+
doc
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
20
18
|
|
21
19
|
after(:all) do
|
22
|
-
Object.send(:remove_const, :
|
20
|
+
Object.send(:remove_const, :TestClass)
|
23
21
|
end
|
24
22
|
|
25
23
|
describe "with multiple objects" do
|
26
|
-
let!(:instance1) {
|
27
|
-
let!(:instance2) {
|
28
|
-
let!(:instance3) {
|
24
|
+
let!(:instance1) { TestClass.create!(foo: ['Beta'], bar: ['Chips']) }
|
25
|
+
let!(:instance2) { TestClass.create!(foo: ['Alpha'], bar: ['Peanuts']) }
|
26
|
+
let!(:instance3) { TestClass.create!(foo: ['Sigma'], bar: ['Peanuts']) }
|
29
27
|
|
30
|
-
subject {
|
28
|
+
subject { TestClass.where(bar: 'Peanuts') }
|
31
29
|
|
32
30
|
it "maps" do
|
33
31
|
expect(subject.map(&:id)).to eq [instance2.id, instance3.id]
|
@@ -1,30 +1,25 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe ActiveFedora::
|
3
|
+
describe ActiveFedora::Scoping::Named do
|
4
4
|
before do
|
5
|
-
|
6
|
-
class Base < ActiveFedora::Base
|
7
|
-
include ActiveFedora::Model
|
8
|
-
end
|
9
|
-
class Basic < Base
|
10
|
-
end
|
5
|
+
class TestClass < ActiveFedora::Base
|
11
6
|
end
|
12
7
|
end
|
13
|
-
let!(:test_instance) {
|
8
|
+
let!(:test_instance) { TestClass.create! }
|
14
9
|
|
15
10
|
after do
|
16
11
|
test_instance.delete
|
17
|
-
Object.send(:remove_const, :
|
12
|
+
Object.send(:remove_const, :TestClass)
|
18
13
|
end
|
19
14
|
|
20
15
|
describe "#all" do
|
21
16
|
it "returns an array of instances of the calling Class" do
|
22
|
-
result =
|
17
|
+
result = TestClass.all.to_a
|
23
18
|
expect(result).to be_instance_of(Array)
|
24
19
|
# this test is meaningless if the array length is zero
|
25
20
|
expect(result).to_not be_empty
|
26
21
|
result.each do |obj|
|
27
|
-
expect(obj.class).to eq
|
22
|
+
expect(obj.class).to eq TestClass
|
28
23
|
end
|
29
24
|
end
|
30
25
|
end
|
@@ -32,15 +27,16 @@ describe ActiveFedora::Model do
|
|
32
27
|
describe '#find' do
|
33
28
|
describe "#find with a valid id without cast" do
|
34
29
|
subject { ActiveFedora::Base.find(test_instance.id) }
|
35
|
-
it { should be_instance_of
|
30
|
+
it { should be_instance_of TestClass }
|
36
31
|
end
|
37
32
|
describe "#find with a valid id with cast of false" do
|
38
33
|
subject { ActiveFedora::Base.find(test_instance.id, cast: false) }
|
39
34
|
it { should be_instance_of ActiveFedora::Base }
|
40
35
|
end
|
36
|
+
|
41
37
|
describe "#find with a valid id without cast on a model extending Base" do
|
42
|
-
subject {
|
43
|
-
it { should be_instance_of
|
38
|
+
subject { TestClass.find(test_instance.id) }
|
39
|
+
it { should be_instance_of TestClass }
|
44
40
|
end
|
45
41
|
end
|
46
42
|
end
|
@@ -2,41 +2,25 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ActiveFedora::SolrHit do
|
4
4
|
before do
|
5
|
-
class MyDS < ActiveFedora::OmDatastream
|
6
|
-
set_terminology do |t|
|
7
|
-
t.root(path: "durh")
|
8
|
-
t.foo
|
9
|
-
t.bar
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
5
|
class Foo < ActiveFedora::Base
|
14
|
-
has_subresource 'descMetadata', class_name: 'MyDS'
|
15
|
-
Deprecation.silence(ActiveFedora::Attributes) do
|
16
|
-
has_attributes :foo, datastream: 'descMetadata', multiple: true
|
17
|
-
has_attributes :bar, datastream: 'descMetadata', multiple: false
|
18
|
-
end
|
19
6
|
property :title, predicate: ::RDF::Vocab::DC.title, multiple: false
|
20
7
|
end
|
21
8
|
end
|
22
9
|
|
10
|
+
after do
|
11
|
+
Object.send(:remove_const, :Foo)
|
12
|
+
end
|
13
|
+
|
23
14
|
let(:another) { Foo.create }
|
24
15
|
|
25
16
|
let!(:obj) { Foo.create!(
|
26
17
|
id: 'test-123',
|
27
|
-
foo: ["baz"],
|
28
|
-
bar: 'quix',
|
29
18
|
title: 'My Title'
|
30
19
|
) }
|
31
20
|
|
32
21
|
let(:doc) { obj.to_solr }
|
33
22
|
let(:solr_hit) { described_class.new(doc) }
|
34
23
|
|
35
|
-
after do
|
36
|
-
Object.send(:remove_const, :Foo)
|
37
|
-
Object.send(:remove_const, :MyDS)
|
38
|
-
end
|
39
|
-
|
40
24
|
describe "#reify" do
|
41
25
|
subject { solr_hit.reify }
|
42
26
|
|