active-fedora 11.0.0.rc1 → 11.0.0.rc2
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/lib/active_fedora/railtie.rb +2 -2
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/associations_spec.rb +17 -18
- data/spec/integration/attached_files_spec.rb +4 -4
- data/spec/integration/attributes_spec.rb +12 -16
- data/spec/integration/autosave_association_spec.rb +5 -5
- data/spec/integration/base_spec.rb +2 -2
- data/spec/integration/collection_association_spec.rb +2 -5
- data/spec/integration/datastream_rdf_nested_attributes_spec.rb +23 -23
- data/spec/integration/date_time_properties_spec.rb +1 -2
- data/spec/integration/direct_container_spec.rb +8 -8
- data/spec/integration/directly_contains_one_association_spec.rb +11 -13
- data/spec/integration/fedora_solr_sync_spec.rb +2 -2
- data/spec/integration/file_fixity_spec.rb +6 -8
- data/spec/integration/file_spec.rb +9 -10
- data/spec/integration/has_many_associations_spec.rb +6 -8
- data/spec/integration/indirect_container_spec.rb +8 -9
- data/spec/integration/json_serialization_spec.rb +4 -4
- data/spec/integration/ntriples_datastream_spec.rb +74 -74
- data/spec/integration/om_datastream_spec.rb +13 -13
- data/spec/integration/rdf_nested_attributes_spec.rb +6 -6
- data/spec/integration/relation_delegation_spec.rb +8 -8
- data/spec/integration/relation_spec.rb +13 -16
- data/spec/integration/solr_hit_spec.rb +4 -4
- data/spec/integration/versionable_spec.rb +132 -132
- data/spec/unit/aggregation/list_source_spec.rb +37 -37
- data/spec/unit/aggregation/ordered_reader_spec.rb +4 -4
- data/spec/unit/association_hash_spec.rb +15 -15
- data/spec/unit/attached_files_spec.rb +19 -19
- data/spec/unit/attributes_spec.rb +25 -25
- data/spec/unit/base_active_model_spec.rb +8 -8
- data/spec/unit/base_extra_spec.rb +5 -4
- data/spec/unit/base_spec.rb +9 -9
- data/spec/unit/change_set_spec.rb +5 -5
- data/spec/unit/core_spec.rb +26 -26
- data/spec/unit/default_model_mapper_spec.rb +3 -3
- data/spec/unit/fedora_spec.rb +2 -2
- data/spec/unit/file_configurator_spec.rb +92 -92
- data/spec/unit/file_spec.rb +60 -60
- data/spec/unit/files_hash_spec.rb +7 -7
- data/spec/unit/has_and_belongs_to_many_association_spec.rb +12 -12
- data/spec/unit/has_many_association_spec.rb +2 -2
- data/spec/unit/indexers/global_indexer_spec.rb +6 -6
- data/spec/unit/indexing_service_spec.rb +5 -5
- data/spec/unit/indexing_spec.rb +4 -4
- data/spec/unit/loadable_from_json_spec.rb +4 -4
- data/spec/unit/model_classifier_spec.rb +4 -4
- data/spec/unit/nom_datastream_spec.rb +8 -8
- data/spec/unit/om_datastream_spec.rb +43 -43
- data/spec/unit/ordered_spec.rb +142 -142
- data/spec/unit/orders/list_node_spec.rb +20 -20
- data/spec/unit/orders/ordered_list_spec.rb +96 -96
- data/spec/unit/orders/reflection_spec.rb +3 -3
- data/spec/unit/pathing_spec.rb +4 -4
- data/spec/unit/persistence_spec.rb +28 -28
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +8 -8
- data/spec/unit/query_spec.rb +5 -5
- data/spec/unit/rdf/indexing_service_spec.rb +17 -17
- data/spec/unit/rdf_datastream_spec.rb +10 -10
- data/spec/unit/rdf_resource_datastream_spec.rb +37 -37
- data/spec/unit/rdfxml_datastream_spec.rb +14 -14
- data/spec/unit/readonly_spec.rb +5 -4
- data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +9 -9
- data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +9 -9
- data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +9 -9
- data/spec/unit/schema_indexing_strategy_spec.rb +5 -5
- data/spec/unit/serializers_spec.rb +3 -4
- data/spec/unit/solr_hit_spec.rb +9 -9
- data/spec/unit/sparql_insert_spec.rb +2 -2
- data/spec/unit/validations_spec.rb +9 -9
- data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +2 -1
- data/spec/unit/with_metadata/metadata_node_spec.rb +3 -2
- metadata +2 -2
data/spec/unit/file_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe ActiveFedora::File do
|
4
4
|
let(:file) { described_class.new }
|
5
5
|
|
6
|
-
subject { file }
|
6
|
+
subject(:af_file) { file }
|
7
7
|
|
8
8
|
it { is_expected.not_to be_metadata }
|
9
9
|
|
@@ -43,7 +43,7 @@ describe ActiveFedora::File do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "#uri" do
|
46
|
-
subject { file.uri }
|
46
|
+
subject(:uri) { file.uri }
|
47
47
|
|
48
48
|
context "when the file is in an ldp:BasicContainer" do
|
49
49
|
let(:parent) { ActiveFedora::Base.new(id: '1234') }
|
@@ -51,14 +51,14 @@ describe ActiveFedora::File do
|
|
51
51
|
context "and it's initialized with the URI" do
|
52
52
|
let(:file) { described_class.new(parent.uri + "/FOO1") }
|
53
53
|
it "works" do
|
54
|
-
expect(
|
54
|
+
expect(uri.to_s).to eq "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/1234/FOO1"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
context "and it's initialized with an ID" do
|
59
59
|
let(:file) { described_class.new(parent.id + "/FOO1") }
|
60
60
|
it "works" do
|
61
|
-
expect(
|
61
|
+
expect(uri.to_s).to eq "#{ActiveFedora.fedora.host}#{ActiveFedora.fedora.base_path}/1234/FOO1"
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
@@ -91,18 +91,18 @@ describe ActiveFedora::File do
|
|
91
91
|
let(:ldp_source) { Ldp::Resource.new(mock_client, path) }
|
92
92
|
|
93
93
|
before do
|
94
|
-
allow(
|
94
|
+
allow(af_file).to receive(:ldp_source).and_return(ldp_source)
|
95
95
|
end
|
96
96
|
|
97
97
|
describe '#persisted_size' do
|
98
98
|
it 'loads the file size attribute from the fedora repository' do
|
99
|
-
expect(
|
99
|
+
expect(af_file.size).to eq 9999
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'returns nil without making a head request to Ldp::Resource::BinarySource if it is a new record' do
|
103
|
-
allow(
|
104
|
-
expect(
|
105
|
-
expect(
|
103
|
+
allow(af_file).to receive(:new_record?).and_return(true)
|
104
|
+
expect(af_file.ldp_source).not_to receive(:head)
|
105
|
+
expect(af_file.persisted_size).to eq nil
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
@@ -112,15 +112,15 @@ describe ActiveFedora::File do
|
|
112
112
|
it 'returns the size of the dirty content' do
|
113
113
|
dirty_content = double
|
114
114
|
allow(dirty_content).to receive(:size) { 8_675_309 }
|
115
|
-
|
116
|
-
expect(
|
115
|
+
af_file.content = dirty_content
|
116
|
+
expect(af_file.size).to eq dirty_content.size
|
117
117
|
end
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
121
|
context 'when content has not changed from what is currently persisted' do
|
122
122
|
it 'returns nil, indicating that the content is not "dirty", but its not necessarily 0 either.' do
|
123
|
-
expect(
|
123
|
+
expect(af_file.dirty_size).to be_nil
|
124
124
|
end
|
125
125
|
end
|
126
126
|
end
|
@@ -128,55 +128,55 @@ describe ActiveFedora::File do
|
|
128
128
|
describe '#size' do
|
129
129
|
context 'when content has not changed' do
|
130
130
|
it 'returns the value of .persisted_size' do
|
131
|
-
expect(
|
131
|
+
expect(af_file.size).to eq af_file.persisted_size
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
135
|
context 'when content has changed' do
|
136
136
|
it 'returns the value of .dirty_size' do
|
137
|
-
|
138
|
-
expect(
|
137
|
+
af_file.content = "i have changed!"
|
138
|
+
expect(af_file.size).to eq af_file.dirty_size
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
142
|
it 'returns nil when #persisted_size and #dirty_size return nil' do
|
143
|
-
allow(
|
144
|
-
allow(
|
145
|
-
expect(
|
143
|
+
allow(af_file).to receive(:persisted_size) { nil }
|
144
|
+
allow(af_file).to receive(:dirty_size) { nil }
|
145
|
+
expect(af_file.size).to be_nil
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
149
|
describe ".empty?" do
|
150
150
|
it "does not be empty" do
|
151
|
-
expect(
|
151
|
+
expect(af_file.empty?).to be false
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
155
|
describe ".has_content?" do
|
156
156
|
context "when there's content" do
|
157
157
|
before do
|
158
|
-
allow(
|
158
|
+
allow(af_file).to receive(:size).and_return(10)
|
159
159
|
end
|
160
160
|
it "returns true" do
|
161
|
-
expect(
|
161
|
+
expect(af_file.has_content?).to be true
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
165
|
context "when size is nil" do
|
166
166
|
before do
|
167
|
-
allow(
|
167
|
+
allow(af_file).to receive(:size).and_return(nil)
|
168
168
|
end
|
169
169
|
it "does not have content" do
|
170
|
-
expect(
|
170
|
+
expect(af_file).to_not have_content
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
174
|
context "when content is zero" do
|
175
175
|
before do
|
176
|
-
allow(
|
176
|
+
allow(af_file).to receive(:size).and_return(0)
|
177
177
|
end
|
178
178
|
it "returns false" do
|
179
|
-
expect(
|
179
|
+
expect(af_file.has_content?).to be false
|
180
180
|
end
|
181
181
|
end
|
182
182
|
end
|
@@ -286,14 +286,14 @@ describe ActiveFedora::File do
|
|
286
286
|
describe "#checksum" do
|
287
287
|
let(:digest) { RDF::URI.new("urn:sha1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15") }
|
288
288
|
before do
|
289
|
-
allow(
|
289
|
+
allow(af_file).to receive(:digest) { [digest] }
|
290
290
|
end
|
291
291
|
its(:checksum) { is_expected.to be_a(ActiveFedora::Checksum) }
|
292
292
|
it "has the right value" do
|
293
|
-
expect(
|
293
|
+
expect(af_file.checksum.value).to eq("f1d2d2f924e986ac86fdf7b36c94bcdf32beec15")
|
294
294
|
end
|
295
295
|
it "has the right algorithm" do
|
296
|
-
expect(
|
296
|
+
expect(af_file.checksum.algorithm).to eq("SHA1")
|
297
297
|
end
|
298
298
|
end
|
299
299
|
|
@@ -358,7 +358,7 @@ describe ActiveFedora::File do
|
|
358
358
|
Object.send(:remove_const, :MyFile)
|
359
359
|
end
|
360
360
|
|
361
|
-
subject { MyFile.new }
|
361
|
+
subject(:my_file) { MyFile.new }
|
362
362
|
|
363
363
|
describe "initialize" do
|
364
364
|
specify {
|
@@ -370,21 +370,21 @@ describe ActiveFedora::File do
|
|
370
370
|
describe "create" do
|
371
371
|
describe "when content is not nil" do
|
372
372
|
specify {
|
373
|
-
expect(
|
374
|
-
expect(
|
375
|
-
expect(
|
376
|
-
expect(
|
377
|
-
|
378
|
-
|
373
|
+
expect(my_file).to receive(:b_create).once
|
374
|
+
expect(my_file).to receive(:a_create).once
|
375
|
+
expect(my_file).to receive(:b_save).once
|
376
|
+
expect(my_file).to receive(:a_save).once
|
377
|
+
my_file.content = "foo"
|
378
|
+
my_file.save
|
379
379
|
}
|
380
380
|
end
|
381
381
|
describe "when content is nil" do
|
382
382
|
specify {
|
383
|
-
expect(
|
384
|
-
expect(
|
385
|
-
expect(
|
386
|
-
expect(
|
387
|
-
|
383
|
+
expect(my_file).to receive(:b_create).once
|
384
|
+
expect(my_file).not_to receive(:a_create)
|
385
|
+
expect(my_file).to receive(:b_save).once
|
386
|
+
expect(my_file).not_to receive(:a_save)
|
387
|
+
my_file.save
|
388
388
|
}
|
389
389
|
end
|
390
390
|
end
|
@@ -392,36 +392,36 @@ describe ActiveFedora::File do
|
|
392
392
|
describe "update" do
|
393
393
|
describe "when content has changed" do
|
394
394
|
specify {
|
395
|
-
|
396
|
-
|
397
|
-
expect(
|
398
|
-
expect(
|
399
|
-
expect(
|
400
|
-
expect(
|
401
|
-
|
402
|
-
|
395
|
+
my_file.content = "foo"
|
396
|
+
my_file.save
|
397
|
+
expect(my_file).to receive(:b_save).once
|
398
|
+
expect(my_file).to receive(:a_save).once
|
399
|
+
expect(my_file).to receive(:b_update).once
|
400
|
+
expect(my_file).to receive(:a_update).once
|
401
|
+
my_file.content = "bar"
|
402
|
+
my_file.save
|
403
403
|
}
|
404
404
|
end
|
405
405
|
describe "when content has not changed" do
|
406
406
|
specify {
|
407
|
-
|
408
|
-
|
409
|
-
expect(
|
410
|
-
expect(
|
411
|
-
expect(
|
412
|
-
expect(
|
413
|
-
|
407
|
+
my_file.content = "foo"
|
408
|
+
my_file.save
|
409
|
+
expect(my_file).to receive(:b_save).once
|
410
|
+
expect(my_file).to receive(:a_save)
|
411
|
+
expect(my_file).to receive(:b_update).once
|
412
|
+
expect(my_file).to receive(:a_update)
|
413
|
+
my_file.save
|
414
414
|
}
|
415
415
|
end
|
416
416
|
end
|
417
417
|
|
418
418
|
describe "destroy" do
|
419
419
|
specify {
|
420
|
-
|
421
|
-
|
422
|
-
expect(
|
423
|
-
expect(
|
424
|
-
|
420
|
+
my_file.content = "foo"
|
421
|
+
my_file.save
|
422
|
+
expect(my_file).to receive(:b_destroy).once
|
423
|
+
expect(my_file).to receive(:a_destroy).once
|
424
|
+
my_file.destroy
|
425
425
|
}
|
426
426
|
end
|
427
427
|
end
|
@@ -15,21 +15,21 @@ describe ActiveFedora::FilesHash do
|
|
15
15
|
let(:object) { double('object') }
|
16
16
|
let(:container) { FilesContainer.new }
|
17
17
|
|
18
|
-
subject { described_class.new(container) }
|
18
|
+
subject(:file_hash) { described_class.new(container) }
|
19
19
|
|
20
20
|
describe "#key?" do
|
21
21
|
context 'when the key is present' do
|
22
22
|
it "is true" do
|
23
|
-
expect(
|
23
|
+
expect(file_hash.key?(:file)).to be true
|
24
24
|
end
|
25
25
|
it "returns true if a string is passed" do
|
26
|
-
expect(
|
26
|
+
expect(file_hash.key?('file')).to be true
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
context 'when the key is not present' do
|
31
31
|
it "is false" do
|
32
|
-
expect(
|
32
|
+
expect(file_hash.key?(:foo)).to be false
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -37,16 +37,16 @@ describe ActiveFedora::FilesHash do
|
|
37
37
|
describe "#[]" do
|
38
38
|
context 'when the key is present' do
|
39
39
|
it "returns the object" do
|
40
|
-
expect(
|
40
|
+
expect(file_hash[:file]).to eq object
|
41
41
|
end
|
42
42
|
it "returns the object if a string is passed" do
|
43
|
-
expect(
|
43
|
+
expect(file_hash['file']).to eq object
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
context 'when the key is not present' do
|
48
48
|
it "is nil" do
|
49
|
-
expect(
|
49
|
+
expect(file_hash[:foo]).to be_nil
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -10,30 +10,30 @@ describe ActiveFedora::Associations::HasAndBelongsToManyAssociation do
|
|
10
10
|
allow_any_instance_of(Book).to receive(:load_datastreams).and_return(false)
|
11
11
|
allow_any_instance_of(Page).to receive(:load_datastreams).and_return(false)
|
12
12
|
|
13
|
-
allow(
|
14
|
-
allow(
|
13
|
+
allow(book).to receive(:new_record?).and_return(false)
|
14
|
+
allow(book).to receive(:save).and_return(true)
|
15
15
|
end
|
16
16
|
|
17
17
|
after do
|
18
18
|
Object.send(:remove_const, :Book)
|
19
19
|
Object.send(:remove_const, :Page)
|
20
20
|
end
|
21
|
-
subject { Book.new('subject-a') }
|
21
|
+
subject(:book) { Book.new('subject-a') }
|
22
22
|
|
23
23
|
context "a one way relationship " do
|
24
24
|
describe "adding memeber" do
|
25
25
|
it "sets the relationship attribute" do
|
26
26
|
reflection = ActiveFedora::Reflection.create(:has_and_belongs_to_many, :pages, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOfCollection }, Book)
|
27
27
|
allow(ActiveFedora::SolrService).to receive(:query).and_return([])
|
28
|
-
ac = described_class.new(
|
28
|
+
ac = described_class.new(book, reflection)
|
29
29
|
expect(ac).to receive(:callback).twice
|
30
30
|
object = Page.new
|
31
31
|
allow(object).to receive(:new_record?).and_return(false)
|
32
32
|
allow(object).to receive(:save).and_return(true)
|
33
33
|
allow(object).to receive(:id).and_return('1234')
|
34
34
|
|
35
|
-
allow(
|
36
|
-
expect(
|
35
|
+
allow(book).to receive(:[]).with('page_ids').and_return([])
|
36
|
+
expect(book).to receive(:[]=).with('page_ids', ['1234'])
|
37
37
|
|
38
38
|
ac.concat object
|
39
39
|
end
|
@@ -42,9 +42,9 @@ describe ActiveFedora::Associations::HasAndBelongsToManyAssociation do
|
|
42
42
|
describe "finding member" do
|
43
43
|
let(:ids) { (0..15).map(&:to_s) }
|
44
44
|
let(:reflection) { ActiveFedora::Reflection.create(:has_and_belongs_to_many, :pages, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOfCollection }, Book) }
|
45
|
-
let(:association) { described_class.new(
|
45
|
+
let(:association) { described_class.new(book, reflection) }
|
46
46
|
it "calls ActiveFedora::Base.find" do
|
47
|
-
expect(
|
47
|
+
expect(book).to receive(:[]).with('page_ids').and_return(ids)
|
48
48
|
expect(ActiveFedora::Base).to receive(:find).with(ids)
|
49
49
|
association.send(:find_target)
|
50
50
|
end
|
@@ -54,7 +54,7 @@ describe ActiveFedora::Associations::HasAndBelongsToManyAssociation do
|
|
54
54
|
context "with an inverse reflection" do
|
55
55
|
let!(:inverse) { ActiveFedora::Reflection.create(:has_and_belongs_to_many, :books, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOfCollection }, Page) }
|
56
56
|
let(:reflection) { ActiveFedora::Reflection.create(:has_and_belongs_to_many, :pages, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.hasCollectionMember, inverse_of: 'books' }, Book) }
|
57
|
-
let(:ac) { described_class.new(
|
57
|
+
let(:ac) { described_class.new(book, reflection) }
|
58
58
|
let(:object) { Page.new }
|
59
59
|
|
60
60
|
it "sets the relationship attribute on subject and object when inverse_of is given" do
|
@@ -63,11 +63,11 @@ describe ActiveFedora::Associations::HasAndBelongsToManyAssociation do
|
|
63
63
|
allow(object).to receive(:new_record?).and_return(false)
|
64
64
|
allow(object).to receive(:save).and_return(true)
|
65
65
|
|
66
|
-
allow(
|
67
|
-
expect(
|
66
|
+
allow(book).to receive(:[]).with('page_ids').and_return([])
|
67
|
+
expect(book).to receive(:[]=).with('page_ids', [object.id])
|
68
68
|
|
69
69
|
expect(object).to receive(:[]).with('book_ids').and_return([]).twice
|
70
|
-
expect(object).to receive(:[]=).with('book_ids', [
|
70
|
+
expect(object).to receive(:[]=).with('book_ids', [book.id])
|
71
71
|
|
72
72
|
ac.concat object
|
73
73
|
end
|
@@ -41,10 +41,10 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
41
41
|
let(:book_reflection) { ActiveFedora::Reflection.create(:has_many, 'pages', nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf }, Book) }
|
42
42
|
let(:association) { described_class.new(book, book_reflection) }
|
43
43
|
|
44
|
-
subject { association.send(:find_polymorphic_inverse, page) }
|
44
|
+
subject(:af_page) { association.send(:find_polymorphic_inverse, page) }
|
45
45
|
|
46
46
|
it "finds the HABTM reflection" do
|
47
|
-
expect(
|
47
|
+
expect(af_page.name).to eq :contents
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
RSpec.describe ActiveFedora::Indexers::GlobalIndexer do
|
4
|
-
|
4
|
+
let(:global_indexer) { described_class.new(index_types) }
|
5
5
|
let(:index_types) {}
|
6
6
|
|
7
7
|
describe "#new" do
|
8
8
|
# The global indexer acts as both an indexer factory and an indexer, since
|
9
9
|
# the property doesn't matter.
|
10
10
|
it "returns itself" do
|
11
|
-
expect(
|
11
|
+
expect(global_indexer.new("bla")).to eq global_indexer
|
12
12
|
end
|
13
13
|
end
|
14
14
|
describe "#index" do
|
@@ -16,7 +16,7 @@ RSpec.describe ActiveFedora::Indexers::GlobalIndexer do
|
|
16
16
|
context "with one index type" do
|
17
17
|
let(:index_types) { :symbol }
|
18
18
|
it "passes that to index_obj" do
|
19
|
-
|
19
|
+
global_indexer.index(index_obj)
|
20
20
|
|
21
21
|
expect(index_obj).to have_received(:as).with(:symbol)
|
22
22
|
end
|
@@ -24,15 +24,15 @@ RSpec.describe ActiveFedora::Indexers::GlobalIndexer do
|
|
24
24
|
context "with multiple index types" do
|
25
25
|
let(:index_types) { [:symbol, :stored_searchable] }
|
26
26
|
it "passes that to index_obj" do
|
27
|
-
|
27
|
+
global_indexer.index(index_obj)
|
28
28
|
|
29
29
|
expect(index_obj).to have_received(:as).with(:symbol, :stored_searchable)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
context "with no index types" do
|
33
|
-
|
33
|
+
let(:global_indexer) { described_class.new }
|
34
34
|
it "does not pass anything to index_obj" do
|
35
|
-
|
35
|
+
global_indexer.index(index_obj)
|
36
36
|
|
37
37
|
expect(index_obj).not_to have_received(:as)
|
38
38
|
end
|
@@ -6,22 +6,22 @@ describe ActiveFedora::IndexingService do
|
|
6
6
|
|
7
7
|
describe "#generate_solr_document" do
|
8
8
|
context "when no block is passed" do
|
9
|
-
subject { indexer.generate_solr_document }
|
9
|
+
subject(:solr_doc) { indexer.generate_solr_document }
|
10
10
|
it "produces a document" do
|
11
|
-
expect(
|
11
|
+
expect(solr_doc['has_model_ssim']).to eq ['ActiveFedora::Base']
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
context "when a block is passed" do
|
16
|
-
subject do
|
16
|
+
subject(:solr_doc) do
|
17
17
|
indexer.generate_solr_document do |solr_doc|
|
18
18
|
solr_doc['noid'] = '12345'
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
it "produces and yield the document" do
|
23
|
-
expect(
|
24
|
-
expect(
|
23
|
+
expect(solr_doc['has_model_ssim']).to eq ['ActiveFedora::Base']
|
24
|
+
expect(solr_doc['noid']).to eq '12345'
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|