active-fedora 8.2.1 → 8.2.2
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/active-fedora.gemspec +1 -2
- data/lib/active_fedora/datastream_collections.rb +4 -8
- data/lib/active_fedora/datastreams.rb +7 -9
- data/lib/active_fedora/version.rb +1 -1
- data/spec/config_helper.rb +3 -3
- data/spec/integration/associations_spec.rb +76 -76
- data/spec/integration/auditable_spec.rb +7 -7
- data/spec/integration/autosave_association_spec.rb +3 -3
- data/spec/integration/base_spec.rb +51 -51
- data/spec/integration/belongs_to_association_spec.rb +27 -27
- data/spec/integration/bug_spec.rb +1 -1
- data/spec/integration/collection_association_spec.rb +2 -2
- data/spec/integration/complex_rdf_datastream_spec.rb +32 -32
- data/spec/integration/datastream_collections_spec.rb +42 -42
- data/spec/integration/datastream_spec.rb +19 -19
- data/spec/integration/datastreams_spec.rb +25 -25
- data/spec/integration/delete_all_spec.rb +5 -5
- data/spec/integration/fedora_solr_sync_spec.rb +1 -1
- data/spec/integration/full_featured_model_spec.rb +9 -9
- data/spec/integration/has_and_belongs_to_many_associations_spec.rb +46 -47
- data/spec/integration/has_many_associations_spec.rb +17 -17
- data/spec/integration/json_serialization_spec.rb +2 -2
- data/spec/integration/load_from_solr_spec.rb +1 -1
- data/spec/integration/model_spec.rb +9 -9
- data/spec/integration/nested_attribute_spec.rb +17 -17
- data/spec/integration/ntriples_datastream_spec.rb +43 -43
- data/spec/integration/om_datastream_spec.rb +37 -37
- data/spec/integration/persistence_spec.rb +1 -1
- data/spec/integration/rdf_nested_attributes_spec.rb +9 -9
- data/spec/integration/relation_delegation_spec.rb +7 -7
- data/spec/integration/relation_spec.rb +2 -2
- data/spec/integration/rels_ext_datastream_spec.rb +3 -3
- data/spec/integration/scoped_query_spec.rb +14 -14
- data/spec/integration/solr_service_spec.rb +24 -24
- data/spec/support/mock_fedora.rb +9 -10
- data/spec/unit/active_fedora_spec.rb +20 -20
- data/spec/unit/attributes_spec.rb +24 -24
- data/spec/unit/base_active_model_spec.rb +6 -6
- data/spec/unit/base_cma_spec.rb +2 -2
- data/spec/unit/base_datastream_management_spec.rb +7 -7
- data/spec/unit/base_extra_spec.rb +20 -20
- data/spec/unit/base_spec.rb +141 -141
- data/spec/unit/builder/has_and_belongs_to_many_spec.rb +1 -1
- data/spec/unit/callback_spec.rb +12 -12
- data/spec/unit/code_configurator_spec.rb +7 -7
- data/spec/unit/config_spec.rb +2 -2
- data/spec/unit/content_model_spec.rb +19 -20
- data/spec/unit/core_spec.rb +1 -1
- data/spec/unit/datastream_collections_spec.rb +101 -101
- data/spec/unit/datastream_spec.rb +12 -12
- data/spec/unit/datastreams_spec.rb +39 -39
- data/spec/unit/file_configurator_spec.rb +117 -117
- data/spec/unit/has_and_belongs_to_many_collection_spec.rb +16 -16
- data/spec/unit/has_many_collection_spec.rb +5 -5
- data/spec/unit/inheritance_spec.rb +5 -5
- data/spec/unit/model_spec.rb +5 -5
- data/spec/unit/nom_datastream_spec.rb +5 -5
- data/spec/unit/ntriples_datastream_spec.rb +56 -56
- data/spec/unit/om_datastream_spec.rb +99 -99
- data/spec/unit/persistence_spec.rb +2 -2
- data/spec/unit/predicates_spec.rb +28 -28
- data/spec/unit/property_spec.rb +5 -5
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +10 -10
- data/spec/unit/query_spec.rb +66 -66
- data/spec/unit/rdf_datastream_spec.rb +10 -10
- data/spec/unit/rdf_resource_datastream_spec.rb +2 -2
- data/spec/unit/rdf_xml_writer_spec.rb +3 -3
- data/spec/unit/rdfxml_rdf_datastream_spec.rb +9 -9
- data/spec/unit/relationship_graph_spec.rb +31 -31
- data/spec/unit/reload_on_save_spec.rb +3 -3
- data/spec/unit/rels_ext_datastream_spec.rb +28 -28
- data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +11 -11
- data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +11 -11
- data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +11 -11
- data/spec/unit/rspec_matchers/match_fedora_datastream_matcher_spec.rb +7 -7
- data/spec/unit/rubydora_connection_spec.rb +3 -3
- data/spec/unit/semantic_node_spec.rb +17 -17
- data/spec/unit/serializers_spec.rb +1 -1
- data/spec/unit/service_definitions_spec.rb +11 -11
- data/spec/unit/simple_datastream_spec.rb +6 -6
- data/spec/unit/solr_config_options_spec.rb +10 -10
- data/spec/unit/solr_digital_object_spec.rb +4 -4
- data/spec/unit/solr_service_spec.rb +41 -41
- data/spec/unit/unsaved_digital_object_spec.rb +8 -8
- data/spec/unit/validations_spec.rb +6 -6
- metadata +4 -4
@@ -31,8 +31,8 @@ describe ActiveFedora::Base do
|
|
31
31
|
describe ".destroy_all" do
|
32
32
|
it "should remove both and run callbacks" do
|
33
33
|
SpecModel::Basic.destroy_all
|
34
|
-
SpecModel::Basic.count.
|
35
|
-
SpecModel::Basic.callback_counter.
|
34
|
+
expect(SpecModel::Basic.count).to eq(0)
|
35
|
+
expect(SpecModel::Basic.callback_counter).to eq(2)
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "when a model is missing" do
|
@@ -48,7 +48,7 @@ describe ActiveFedora::Base do
|
|
48
48
|
it "should be able to skip a missing model" do
|
49
49
|
expect(ActiveFedora::Base.logger).to receive(:error).with("Although #{pid} was found in Solr, it doesn't seem to exist in Fedora. The index is out of synch.")
|
50
50
|
SpecModel::Basic.destroy_all
|
51
|
-
SpecModel::Basic.count.
|
51
|
+
expect(SpecModel::Basic.count).to eq(1)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -56,8 +56,8 @@ describe ActiveFedora::Base do
|
|
56
56
|
describe ".delete_all" do
|
57
57
|
it "should remove both and not run callbacks" do
|
58
58
|
SpecModel::Basic.delete_all
|
59
|
-
SpecModel::Basic.count.
|
60
|
-
SpecModel::Basic.callback_counter.
|
59
|
+
expect(SpecModel::Basic.count).to eq(0)
|
60
|
+
expect(SpecModel::Basic.callback_counter).to eq(0)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -108,16 +108,16 @@ describe ActiveFedora::Base do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
it "should be an instance of ActiveFedora::Base" do
|
111
|
-
@test_history.
|
111
|
+
expect(@test_history).to be_kind_of(ActiveFedora::Base)
|
112
112
|
end
|
113
113
|
|
114
114
|
|
115
115
|
it "should create proxies to all the datastreams" do
|
116
116
|
properties_ds = @test_history.datastreams["properties"]
|
117
117
|
dublin_core_ds = @test_history.datastreams["dublin_core"]
|
118
|
-
@test_history.properties.
|
119
|
-
@test_history.
|
120
|
-
OralHistory.new.
|
118
|
+
expect(@test_history.properties).to be properties_ds
|
119
|
+
expect(@test_history).to respond_to(:properties)
|
120
|
+
expect(OralHistory.new).to respond_to(:properties)
|
121
121
|
end
|
122
122
|
|
123
123
|
|
@@ -142,12 +142,12 @@ describe ActiveFedora::Base do
|
|
142
142
|
@properties_sample_values.each_pair do |field, value|
|
143
143
|
next if field == :hard_copy_availability #FIXME HYDRA-824
|
144
144
|
next if field == :location #FIXME HYDRA-825
|
145
|
-
(@solr_result[ActiveFedora::SolrService.solr_name(field, type: :string)] || @solr_result[ActiveFedora::SolrService.solr_name(field, type: :date)]).
|
145
|
+
expect(@solr_result[ActiveFedora::SolrService.solr_name(field, type: :string)] || @solr_result[ActiveFedora::SolrService.solr_name(field, type: :date)]).to eq([::Solrizer::Extractor.format_node_value(value)])
|
146
146
|
end
|
147
147
|
|
148
148
|
@dublin_core_sample_values.each_pair do |field, value|
|
149
149
|
next if [:format, :type].include?(field) #format and type are methods declared on Object
|
150
|
-
dublin_core_ds.send("#{field.to_s}").
|
150
|
+
expect(dublin_core_ds.send("#{field.to_s}")).to eq([value])
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -158,19 +158,19 @@ describe ActiveFedora::Base do
|
|
158
158
|
dublin_core_ds.subject = "My Subject Heading"
|
159
159
|
dc_xml = REXML::Document.new(dublin_core_ds.to_xml)
|
160
160
|
|
161
|
-
dc_xml.root.elements["dcterms:subject"].text.
|
161
|
+
expect(dc_xml.root.elements["dcterms:subject"].text).to eq("My Subject Heading")
|
162
162
|
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should support #find_with_conditions" do
|
166
166
|
solr_result = OralHistory.find_with_conditions({})
|
167
|
-
solr_result.
|
167
|
+
expect(solr_result).not_to be_nil
|
168
168
|
end
|
169
169
|
|
170
170
|
describe '#new' do
|
171
171
|
it "should support custom pids" do
|
172
172
|
oh = OralHistory.new(:pid=>"uuid:blah-blah-blah")
|
173
|
-
oh.pid.
|
173
|
+
expect(oh.pid).to eq("uuid:blah-blah-blah")
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
@@ -36,14 +36,14 @@ describe ActiveFedora::Base do
|
|
36
36
|
end
|
37
37
|
it "habtm should set and remove relationships bidirectionally" do
|
38
38
|
@book.topics << @topic1
|
39
|
-
@book.topics.
|
40
|
-
@topic1.books.
|
41
|
-
@topic1.reload.books.
|
39
|
+
expect(@book.topics).to eq([@topic1])
|
40
|
+
expect(@topic1.books).to eq([@book])
|
41
|
+
expect(@topic1.reload.books).to eq([@book])
|
42
42
|
|
43
43
|
@book.topics.delete(@topic1)
|
44
44
|
#@topic1.books.delete(@book)
|
45
|
-
@book.topics.
|
46
|
-
@topic1.books.
|
45
|
+
expect(@book.topics).to eq([])
|
46
|
+
expect(@topic1.books).to eq([])
|
47
47
|
end
|
48
48
|
it "Should allow for more than 10 items" do
|
49
49
|
|
@@ -51,16 +51,16 @@ describe ActiveFedora::Base do
|
|
51
51
|
@book.topics << Topic.create
|
52
52
|
end
|
53
53
|
@book.save
|
54
|
-
@book.topics.count.
|
54
|
+
expect(@book.topics.count).to eq(12)
|
55
55
|
book2 = Book.find(@book.pid)
|
56
|
-
book2.topics.count.
|
56
|
+
expect(book2.topics.count).to eq(12)
|
57
57
|
end
|
58
58
|
|
59
59
|
it "Should find inherited objects along with base objects" do
|
60
60
|
@book.topics << @topic1
|
61
61
|
@special_book.topics << @topic1
|
62
|
-
@topic1.books.
|
63
|
-
@topic1.reload.books.
|
62
|
+
expect(@topic1.books).to eq([@book, @special_book])
|
63
|
+
expect(@topic1.reload.books).to eq([@book, @special_book])
|
64
64
|
end
|
65
65
|
|
66
66
|
it "Should cast found books to the correct cmodel" do
|
@@ -83,20 +83,20 @@ describe ActiveFedora::Base do
|
|
83
83
|
end
|
84
84
|
it "should set relationships bidirectionally" do
|
85
85
|
@book.topics << @topic1
|
86
|
-
@book.topics.
|
87
|
-
@book.relationships(:has_topic).
|
88
|
-
@topic1.relationships(:has_topic).
|
89
|
-
@topic1.relationships(:is_topic_of).
|
90
|
-
Topic.find(@topic1.pid).books.
|
86
|
+
expect(@book.topics).to eq([@topic1])
|
87
|
+
expect(@book.relationships(:has_topic)).to eq([@topic1.internal_uri])
|
88
|
+
expect(@topic1.relationships(:has_topic)).to eq([])
|
89
|
+
expect(@topic1.relationships(:is_topic_of)).to eq([@book.internal_uri])
|
90
|
+
expect(Topic.find(@topic1.pid).books).to eq([@book]) #Can't have saved it because @book isn't saved yet.
|
91
91
|
end
|
92
92
|
it "should save new child objects" do
|
93
93
|
@book.topics << Topic.new
|
94
|
-
@book.topics.first.pid.
|
94
|
+
expect(@book.topics.first.pid).not_to be_nil
|
95
95
|
end
|
96
96
|
it "should clear out the old associtions" do
|
97
97
|
@book.topics = [@topic1]
|
98
98
|
@book.topics = [@topic2]
|
99
|
-
@book.topic_ids.
|
99
|
+
expect(@book.topic_ids).to eq([@topic2.pid])
|
100
100
|
end
|
101
101
|
after do
|
102
102
|
@book.delete
|
@@ -135,27 +135,27 @@ describe ActiveFedora::Base do
|
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should have a collection" do
|
138
|
-
book.relationships(:is_member_of_collection).
|
139
|
-
book.collections.
|
138
|
+
expect(book.relationships(:is_member_of_collection)).to eq([collection.internal_uri])
|
139
|
+
expect(book.collections).to eq([collection])
|
140
140
|
end
|
141
141
|
it "habtm should not set foreign relationships if :inverse_of is not specified" do
|
142
|
-
collection.relationships(:is_member_of_collection).
|
142
|
+
expect(collection.relationships(:is_member_of_collection)).to eq([])
|
143
143
|
end
|
144
144
|
it "should load the collections" do
|
145
145
|
reloaded = Book.find(book.pid)
|
146
|
-
reloaded.collections.
|
146
|
+
expect(reloaded.collections).to eq([collection])
|
147
147
|
end
|
148
148
|
|
149
149
|
describe "#empty?" do
|
150
150
|
subject { book.collections }
|
151
|
-
its(:empty?) {
|
151
|
+
its(:empty?) { is_expected.to be_falsey }
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
155
|
context "when a book isn't in a collection" do
|
156
156
|
describe "#empty?" do
|
157
157
|
subject { book.collections }
|
158
|
-
its(:empty?) { should
|
158
|
+
its(:empty?) { should be_truthy }
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
@@ -191,23 +191,23 @@ describe ActiveFedora::Base do
|
|
191
191
|
end
|
192
192
|
|
193
193
|
it "delete should cause the entries to be removed from RELS-EXT, but not destroy the original record" do
|
194
|
-
book.collections.
|
194
|
+
expect(book.collections).to eq([collection1, collection2])
|
195
195
|
book.collections.delete(collection1)
|
196
|
-
book.collections.
|
196
|
+
expect(book.collections).to eq([collection2])
|
197
197
|
book.save!
|
198
198
|
book.reload
|
199
|
-
book.collections.
|
200
|
-
expect
|
199
|
+
expect(book.collections).to eq([collection2])
|
200
|
+
expect(Collection.find(collection1.pid)).to_not be_nil
|
201
201
|
end
|
202
202
|
|
203
203
|
it "destroy should cause the entries to be removed from RELS-EXT, but not destroy the original record" do
|
204
|
-
book.collections.
|
204
|
+
expect(book.collections).to eq([collection1, collection2])
|
205
205
|
book.collections.destroy(collection1)
|
206
|
-
book.collections.
|
206
|
+
expect(book.collections).to eq([collection2])
|
207
207
|
book.save!
|
208
208
|
book.reload
|
209
|
-
book.collections.
|
210
|
-
expect
|
209
|
+
expect(book.collections).to eq([collection2])
|
210
|
+
expect(Collection.find(collection1.pid)).to_not be_nil
|
211
211
|
end
|
212
212
|
end
|
213
213
|
|
@@ -240,25 +240,25 @@ describe ActiveFedora::Base do
|
|
240
240
|
end
|
241
241
|
|
242
242
|
it "destroy should cause the before_remove and after_remove callback to be triggered" do
|
243
|
-
book.
|
244
|
-
book.
|
243
|
+
expect(book).to receive(:foo).with(collection)
|
244
|
+
expect(book).to receive(:bar).with(collection)
|
245
245
|
book.collections.destroy(collection)
|
246
246
|
end
|
247
247
|
|
248
248
|
it "delete should cause the before_remove and after_remove callback to be triggered" do
|
249
|
-
book.
|
250
|
-
book.
|
249
|
+
expect(book).to receive(:foo).with(collection)
|
250
|
+
expect(book).to receive(:bar).with(collection)
|
251
251
|
book.collections.delete(collection)
|
252
252
|
end
|
253
253
|
|
254
254
|
it "should not remove if an exception is thrown in before_remove" do
|
255
|
-
book.
|
256
|
-
book.
|
255
|
+
expect(book).to receive(:foo).with(collection).and_raise
|
256
|
+
expect(book).not_to receive(:bar)
|
257
257
|
begin
|
258
258
|
book.collections.delete(collection)
|
259
259
|
rescue RuntimeError
|
260
260
|
end
|
261
|
-
book.collections.
|
261
|
+
expect(book.collections).to eq([collection])
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
@@ -287,25 +287,25 @@ describe ActiveFedora::Base do
|
|
287
287
|
end
|
288
288
|
|
289
289
|
it "shift should cause the before_add and after_add callback to be triggered" do
|
290
|
-
book.
|
291
|
-
book.
|
290
|
+
expect(book).to receive(:foo).with(collection)
|
291
|
+
expect(book).to receive(:bar).with(collection)
|
292
292
|
book.collections << collection
|
293
293
|
end
|
294
294
|
|
295
295
|
it "assignment should cause the before_add and after_add callback to be triggered" do
|
296
|
-
book.
|
297
|
-
book.
|
296
|
+
expect(book).to receive(:foo).with(collection)
|
297
|
+
expect(book).to receive(:bar).with(collection)
|
298
298
|
book.collections = [collection]
|
299
299
|
end
|
300
300
|
|
301
301
|
it "should not add if an exception is thrown in before_add" do
|
302
|
-
book.
|
303
|
-
book.
|
302
|
+
expect(book).to receive(:foo).with(collection).and_raise
|
303
|
+
expect(book).not_to receive(:bar)
|
304
304
|
begin
|
305
305
|
book.collections << collection
|
306
306
|
rescue RuntimeError
|
307
307
|
end
|
308
|
-
book.collections.
|
308
|
+
expect(book.collections).to eq([])
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
@@ -341,7 +341,7 @@ describe "Autosave" do
|
|
341
341
|
|
342
342
|
it "should save dependent records" do
|
343
343
|
component.reload
|
344
|
-
component.items.first.title.
|
344
|
+
expect(component.items.first.title).to eq('my title')
|
345
345
|
end
|
346
346
|
end
|
347
347
|
describe "From the has_many side" do
|
@@ -349,9 +349,8 @@ describe "Autosave" do
|
|
349
349
|
|
350
350
|
it "should save dependent records" do
|
351
351
|
item.reload
|
352
|
-
item.components.first.description.
|
352
|
+
expect(item.components.first.description).to eq('my description')
|
353
353
|
end
|
354
354
|
end
|
355
355
|
|
356
356
|
end
|
357
|
-
|
@@ -21,7 +21,7 @@ describe "Collection members" do
|
|
21
21
|
expect(library.books).not_to be_loaded
|
22
22
|
expect(library.books.size).to eq(0)
|
23
23
|
expect(library.books).to be_loaded
|
24
|
-
expect(library.books.any?).to
|
24
|
+
expect(library.books.any?).to be_falsey
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -41,9 +41,9 @@ describe "Collection members" do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
it "should cache the results" do
|
44
|
-
expect(library.books.loaded?).to
|
44
|
+
expect(library.books.loaded?).to be_falsey
|
45
45
|
expect(library.books).to eq [book]
|
46
|
-
expect(library.books.loaded?).to
|
46
|
+
expect(library.books.loaded?).to be_truthy
|
47
47
|
end
|
48
48
|
it "should load from solr" do
|
49
49
|
expect(library.books.load_from_solr.map {|r| r["id"]}).to eq([book.pid])
|
@@ -52,9 +52,9 @@ describe "Collection members" do
|
|
52
52
|
expect(library.books.load_from_solr(rows: 0).size).to eq(0)
|
53
53
|
end
|
54
54
|
it "should respond to #any?" do
|
55
|
-
expect(library.books.any?).to
|
56
|
-
expect(library.books.any? {|book| book.library == nil}).to
|
57
|
-
expect(library.books.any? {|book| book.library == library}).to
|
55
|
+
expect(library.books.any?).to be_truthy
|
56
|
+
expect(library.books.any? {|book| book.library == nil}).to be_falsey
|
57
|
+
expect(library.books.any? {|book| book.library == library}).to be_truthy
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -84,7 +84,7 @@ describe "After save callbacks" do
|
|
84
84
|
let(:book) { Book.new(library: library) }
|
85
85
|
it "should have the relationship available in after_save" do
|
86
86
|
book.save!
|
87
|
-
book.library_books.
|
87
|
+
expect(book.library_books).to include book
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -115,8 +115,8 @@ describe "When two or more relationships share the same property" do
|
|
115
115
|
|
116
116
|
it "Should only return relationships of the correct class" do
|
117
117
|
@book.reload
|
118
|
-
@book.people.
|
119
|
-
@book.collections.
|
118
|
+
expect(@book.people).to eq([@person1, @person2])
|
119
|
+
expect(@book.collections).to eq([])
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -150,7 +150,7 @@ describe "When relationship is restricted to AF::Base" do
|
|
150
150
|
end
|
151
151
|
it "Should not restrict relationships " do
|
152
152
|
@book.reload
|
153
|
-
@book.attachments.
|
153
|
+
expect(@book.attachments).to eq([@image, @pdf])
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -168,7 +168,7 @@ describe "When relationship is restricted to AF::Base" do
|
|
168
168
|
it "Should not restrict relationships " do
|
169
169
|
email.attachment_ids = [image.id, pdf.id]
|
170
170
|
email.reload
|
171
|
-
email.attachments.
|
171
|
+
expect(email.attachments).to eq([image, pdf])
|
172
172
|
end
|
173
173
|
end
|
174
174
|
end
|
@@ -194,12 +194,12 @@ describe "Deleting a dependent relationship" do
|
|
194
194
|
it "should remove relationships" do
|
195
195
|
component.item = item
|
196
196
|
component.save!
|
197
|
-
item.components.
|
197
|
+
expect(item.components).to eq([component])
|
198
198
|
item.components.delete(component)
|
199
199
|
item.reload
|
200
200
|
component.reload
|
201
|
-
component.relationships(:is_part_of).
|
202
|
-
item.components.
|
201
|
+
expect(component.relationships(:is_part_of)).to eq([])
|
202
|
+
expect(item.components).to eq([])
|
203
203
|
end
|
204
204
|
|
205
205
|
it "should remove the relationships that point at that object" do
|
@@ -207,7 +207,7 @@ describe "Deleting a dependent relationship" do
|
|
207
207
|
component.save!
|
208
208
|
item.delete
|
209
209
|
component.reload
|
210
|
-
component.relationships(:is_part_of).
|
210
|
+
expect(component.relationships(:is_part_of)).to eq([])
|
211
211
|
end
|
212
212
|
|
213
213
|
it "should only try to delete objects that exist in the datastore (not cached objects)" do
|
@@ -254,7 +254,7 @@ describe "Autosave" do
|
|
254
254
|
|
255
255
|
it "should save dependent records" do
|
256
256
|
component.reload
|
257
|
-
component.item.title.
|
257
|
+
expect(component.item.title).to eq('my title')
|
258
258
|
end
|
259
259
|
end
|
260
260
|
describe "From the has_many side" do
|
@@ -262,7 +262,7 @@ describe "Autosave" do
|
|
262
262
|
|
263
263
|
it "should save dependent records" do
|
264
264
|
item.reload
|
265
|
-
item.components.first.description.
|
265
|
+
expect(item.components.first.description).to eq('my description')
|
266
266
|
end
|
267
267
|
end
|
268
268
|
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "Objects should be serialized to JSON" do
|
4
4
|
it "should have json results" do
|
5
|
-
ActiveFedora::Base.new.to_json.
|
5
|
+
expect(ActiveFedora::Base.new.to_json).to eq("{\"id\":null}")
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "with a more interesting model" do
|
@@ -20,7 +20,7 @@ describe "Objects should be serialized to JSON" do
|
|
20
20
|
Object.send(:remove_const, :Foo)
|
21
21
|
end
|
22
22
|
subject { Foo.new(foo: ["baz"], bar: 'quix') }
|
23
|
-
before { subject.
|
23
|
+
before { allow(subject).to receive_messages(pid: 'test:123') }
|
24
24
|
it "should have to_json" do
|
25
25
|
json = JSON.parse(subject.to_json)
|
26
26
|
expect(json['id']).to eq "test:123"
|
@@ -52,7 +52,7 @@ describe "Loading from solr" do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should be able to get indexed properties without loading from fedora" do
|
55
|
-
RdfTest.connection_for_pid('1').
|
55
|
+
expect(RdfTest.connection_for_pid('1')).not_to receive(:datastream_dissemination)
|
56
56
|
obj = RdfTest.load_instance_from_solr original.pid
|
57
57
|
expect(obj.title).to eq "PLAN 9 FROM OUTER SPACE"
|
58
58
|
expect(obj.date_uploaded).to eq [Date.parse('1959-01-01')]
|