active-fedora 8.2.1 → 8.2.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a6dfd10717c2d461bac0b6cc9f6995d3cf6dc20
|
4
|
+
data.tar.gz: 69d6d72ca460c5e2bd94d6a7958d1ca4052e206e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b86606eba5e479f3134b09294403fc3aaf3425960cf96545e6701ea490fbbdc008d4522d2ae892989fedd153100754c0e1581e9596fb44823ef9ced057ed9ff
|
7
|
+
data.tar.gz: c7220c220a6420afe2d64b4f5150ac28b176fb5a656079529a77d92265fc030a530acfe583a31abeb039a2ae97566b79bb4cba50aff8f987f7ade9f996656690
|
data/active-fedora.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_development_dependency "yard"
|
27
27
|
s.add_development_dependency "rake"
|
28
28
|
s.add_development_dependency "jettywrapper", ">=1.4.0"
|
29
|
-
s.add_development_dependency "rspec", "~>
|
29
|
+
s.add_development_dependency "rspec", "~> 3.0"
|
30
30
|
s.add_development_dependency "rspec-its"
|
31
31
|
s.add_development_dependency "equivalent-xml"
|
32
32
|
s.add_development_dependency "rest-client"
|
@@ -43,4 +43,3 @@ Gem::Specification.new do |s|
|
|
43
43
|
s.require_paths = ["lib"]
|
44
44
|
|
45
45
|
end
|
46
|
-
|
@@ -6,17 +6,13 @@ module ActiveFedora
|
|
6
6
|
included do
|
7
7
|
class_attribute :class_named_datastreams_desc
|
8
8
|
self.class_named_datastreams_desc = {}
|
9
|
-
class << self
|
10
|
-
def inherited_with_datastream_collections(kls) #:nodoc:
|
11
|
-
## Do some inheritance logic that doesn't override Base.inherited
|
12
|
-
inherited_without_datastream_collections kls
|
13
|
-
kls.class_named_datastreams_desc = kls.class_named_datastreams_desc.dup
|
14
|
-
end
|
15
|
-
alias_method_chain :inherited, :datastream_collections
|
16
|
-
end
|
17
9
|
end
|
18
10
|
|
19
11
|
module ClassMethods
|
12
|
+
def inherited(kls) #:nodoc:
|
13
|
+
super
|
14
|
+
kls.class_named_datastreams_desc = kls.class_named_datastreams_desc.dup
|
15
|
+
end
|
20
16
|
|
21
17
|
# Allows for a datastream to be treated like any other attribute of a model class
|
22
18
|
# while enforcing mimeType and/or datastream type (ie. external, managed, etc.) if defined.
|
@@ -7,20 +7,18 @@ module ActiveFedora
|
|
7
7
|
included do
|
8
8
|
class_attribute :ds_specs
|
9
9
|
self.ds_specs = {'RELS-EXT'=> {:type=> ActiveFedora::RelsExtDatastream, :label=>"Fedora Object-to-Object Relationship Metadata", :block=>nil}}
|
10
|
-
class << self
|
11
|
-
def inherited_with_datastreams(kls) #:nodoc:
|
12
|
-
## Do some inheritance logic that doesn't override Base.inherited
|
13
|
-
inherited_without_datastreams kls
|
14
|
-
# each subclass should get a copy of the parent's datastream definitions, it should not add to the parent's definition table.
|
15
|
-
kls.ds_specs = kls.ds_specs.dup
|
16
|
-
end
|
17
|
-
alias_method_chain :inherited, :datastreams
|
18
|
-
end
|
19
10
|
|
20
11
|
before_save :add_disseminator_location_to_datastreams
|
21
12
|
#before_save :serialize_datastreams
|
22
13
|
end
|
23
14
|
|
15
|
+
module ClassMethods
|
16
|
+
def inherited(kls) #:nodoc:
|
17
|
+
super
|
18
|
+
kls.ds_specs = kls.ds_specs.dup
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
24
22
|
def ds_specs
|
25
23
|
self.class.ds_specs
|
26
24
|
end
|
data/spec/config_helper.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
def mock_yaml(hash, path)
|
2
2
|
mock_file = double(path.split("/")[-1])
|
3
|
-
File.
|
4
|
-
File.
|
5
|
-
Psych.
|
3
|
+
allow(File).to receive(:exist?).with(path).and_return(true)
|
4
|
+
allow(File).to receive(:open).with(path).and_return(mock_file)
|
5
|
+
allow(Psych).to receive(:load).and_return(hash)
|
6
6
|
end
|
7
7
|
|
8
8
|
def default_predicate_mapping_file
|
@@ -63,75 +63,75 @@ describe ActiveFedora::Base do
|
|
63
63
|
|
64
64
|
it "should build child" do
|
65
65
|
new_book = @library.books.build({})
|
66
|
-
new_book.
|
67
|
-
new_book.
|
68
|
-
new_book.library.
|
69
|
-
@library.books.
|
66
|
+
expect(new_book).to be_new_record
|
67
|
+
expect(new_book).to be_kind_of Book
|
68
|
+
expect(new_book.library).to be_kind_of Library
|
69
|
+
expect(@library.books).to eq([new_book])
|
70
70
|
end
|
71
71
|
|
72
72
|
it "should make a new child" do
|
73
73
|
new_book = @library.books.new
|
74
|
-
new_book.
|
75
|
-
new_book.
|
76
|
-
new_book.library.
|
77
|
-
@library.books.
|
74
|
+
expect(new_book).to be_new_record
|
75
|
+
expect(new_book).to be_kind_of Book
|
76
|
+
expect(new_book.library).to be_kind_of Library
|
77
|
+
expect(@library.books).to eq([new_book])
|
78
78
|
end
|
79
79
|
|
80
80
|
it "should not create children if the parent isn't saved" do
|
81
|
-
|
81
|
+
expect {@library.books.create({})}.to raise_error ActiveFedora::RecordNotSaved, "You cannot call create unless the parent is saved"
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should create children" do
|
85
85
|
@library.save!
|
86
86
|
new_book = @library.books.create({})
|
87
|
-
new_book.
|
88
|
-
new_book.
|
89
|
-
new_book.library.
|
87
|
+
expect(new_book).not_to be_new_record
|
88
|
+
expect(new_book).to be_kind_of Book
|
89
|
+
expect(new_book.library).to eq(@library)
|
90
90
|
end
|
91
91
|
|
92
92
|
it "should build parent" do
|
93
93
|
new_library = @book.build_library({})
|
94
|
-
new_library.
|
95
|
-
new_library.
|
96
|
-
@book.library.
|
94
|
+
expect(new_library).to be_new_record
|
95
|
+
expect(new_library).to be_kind_of Library
|
96
|
+
expect(@book.library).to eq(new_library)
|
97
97
|
end
|
98
98
|
|
99
99
|
it "should create parent" do
|
100
100
|
new_library = @book.create_library({})
|
101
|
-
new_library.
|
102
|
-
new_library.
|
103
|
-
@book.library.
|
101
|
+
expect(new_library).not_to be_new_record
|
102
|
+
expect(new_library).to be_kind_of Library
|
103
|
+
expect(@book.library).to eq(new_library)
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should let you shift onto the association" do
|
107
|
-
@library.new_record
|
108
|
-
@library.books.size.
|
109
|
-
@library.books.
|
110
|
-
@library.book_ids.
|
107
|
+
expect(@library.new_record?).to be_truthy
|
108
|
+
expect(@library.books.size).to eq(0)
|
109
|
+
expect(@library.books).to eq([])
|
110
|
+
expect(@library.book_ids).to eq([])
|
111
111
|
@library.books << @book
|
112
|
-
@library.books.
|
113
|
-
@library.book_ids.
|
112
|
+
expect(@library.books).to eq([@book])
|
113
|
+
expect(@library.book_ids).to eq([@book.pid])
|
114
114
|
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should let you set an array of objects" do
|
118
118
|
@library.books = [@book, @book2]
|
119
|
-
@library.books.
|
119
|
+
expect(@library.books).to eq([@book, @book2])
|
120
120
|
@library.save
|
121
121
|
|
122
122
|
@library.books = [@book]
|
123
|
-
@library.books.
|
123
|
+
expect(@library.books).to eq([@book])
|
124
124
|
|
125
125
|
end
|
126
126
|
it "should let you set an array of object ids" do
|
127
127
|
@library.book_ids = [@book.pid, @book2.pid]
|
128
|
-
@library.books.
|
128
|
+
expect(@library.books).to eq([@book, @book2])
|
129
129
|
end
|
130
130
|
|
131
131
|
it "setter should wipe out previously saved relations" do
|
132
132
|
@library.book_ids = [@book.pid, @book2.pid]
|
133
133
|
@library.book_ids = [@book2.pid]
|
134
|
-
@library.books.
|
134
|
+
expect(@library.books).to eq([@book2])
|
135
135
|
|
136
136
|
end
|
137
137
|
|
@@ -140,7 +140,7 @@ describe ActiveFedora::Base do
|
|
140
140
|
@library.books = [@book, @book2]
|
141
141
|
@library.save
|
142
142
|
@library = Library.find(@library.pid)
|
143
|
-
@library.books.
|
143
|
+
expect(@library.books).to eq([@book, @book2])
|
144
144
|
end
|
145
145
|
|
146
146
|
|
@@ -152,12 +152,12 @@ describe ActiveFedora::Base do
|
|
152
152
|
@book2.save
|
153
153
|
|
154
154
|
@library = Library.find(@library.pid)
|
155
|
-
@library.books.
|
155
|
+
expect(@library.books).to eq([@book, @book2])
|
156
156
|
|
157
157
|
solr_resp = @library.books(:response_format=>:solr)
|
158
|
-
solr_resp.size.
|
159
|
-
solr_resp[0]['id'].
|
160
|
-
solr_resp[1]['id'].
|
158
|
+
expect(solr_resp.size).to eq(2)
|
159
|
+
expect(solr_resp[0]['id']).to eq(@book.pid)
|
160
|
+
expect(solr_resp[1]['id']).to eq(@book2.pid)
|
161
161
|
|
162
162
|
end
|
163
163
|
|
@@ -181,10 +181,10 @@ describe ActiveFedora::Base do
|
|
181
181
|
end
|
182
182
|
it "should be settable from the book side" do
|
183
183
|
@book.library_id = @library.pid
|
184
|
-
@book.library.
|
185
|
-
@book.library.pid.
|
184
|
+
expect(@book.library).to eq(@library)
|
185
|
+
expect(@book.library.pid).to eq(@library.pid)
|
186
186
|
@book.attributes= {:library_id => ""}
|
187
|
-
@book.library_id.
|
187
|
+
expect(@book.library_id).to be_nil
|
188
188
|
end
|
189
189
|
after do
|
190
190
|
@library.delete
|
@@ -208,12 +208,12 @@ describe ActiveFedora::Base do
|
|
208
208
|
it "should have many books once it has been saved" do
|
209
209
|
@library.books << @book
|
210
210
|
|
211
|
-
@book.library.pid.
|
211
|
+
expect(@book.library.pid).to eq(@library.pid)
|
212
212
|
@library.books.reload
|
213
|
-
@library.books.
|
213
|
+
expect(@library.books).to eq([@book])
|
214
214
|
|
215
215
|
@library2 = Library.find(@library.pid)
|
216
|
-
@library2.books.
|
216
|
+
expect(@library2.books).to eq([@book])
|
217
217
|
end
|
218
218
|
|
219
219
|
it "should have a count once it has been saved" do
|
@@ -221,14 +221,14 @@ describe ActiveFedora::Base do
|
|
221
221
|
@library.save
|
222
222
|
|
223
223
|
@library2 = Library.find(@library.pid)
|
224
|
-
@library2.books.size.
|
224
|
+
expect(@library2.books.size).to eq(2)
|
225
225
|
end
|
226
226
|
|
227
227
|
it "should respect the :class_name parameter" do
|
228
228
|
@book.author = @person
|
229
229
|
@book.save
|
230
|
-
Book.find(@book.id).author_id.
|
231
|
-
Book.find(@book.id).author.
|
230
|
+
expect(Book.find(@book.id).author_id).to eq(@person.pid)
|
231
|
+
expect(Book.find(@book.id).author).to be_kind_of Person
|
232
232
|
end
|
233
233
|
|
234
234
|
it "should respect multiple associations that share the same :property and respect associated class" do
|
@@ -236,11 +236,11 @@ describe ActiveFedora::Base do
|
|
236
236
|
@book.publisher = @publisher
|
237
237
|
@book.save
|
238
238
|
|
239
|
-
Book.find(@book.id).publisher_id.
|
240
|
-
Book.find(@book.id).publisher.
|
239
|
+
expect(Book.find(@book.id).publisher_id).to eq(@publisher.pid)
|
240
|
+
expect(Book.find(@book.id).publisher).to be_kind_of Publisher
|
241
241
|
|
242
|
-
Book.find(@book.id).author_id.
|
243
|
-
Book.find(@book.id).author.
|
242
|
+
expect(Book.find(@book.id).author_id).to eq(@person.pid)
|
243
|
+
expect(Book.find(@book.id).author).to be_kind_of Person
|
244
244
|
end
|
245
245
|
|
246
246
|
describe "when changing the belonger" do
|
@@ -250,10 +250,10 @@ describe ActiveFedora::Base do
|
|
250
250
|
@library2 = Library.create
|
251
251
|
end
|
252
252
|
it "should replace an existing instance" do
|
253
|
-
@book.library_id.
|
253
|
+
expect(@book.library_id).to eq(@library.id)
|
254
254
|
@book.library = @library2
|
255
255
|
@book.save
|
256
|
-
Book.find(@book.id).library_id.
|
256
|
+
expect(Book.find(@book.id).library_id).to eq(@library2.id)
|
257
257
|
end
|
258
258
|
after do
|
259
259
|
@library2.delete
|
@@ -282,11 +282,11 @@ describe ActiveFedora::Base do
|
|
282
282
|
end
|
283
283
|
it "should set the association" do
|
284
284
|
@book.library = @library
|
285
|
-
@book.library.pid.
|
285
|
+
expect(@book.library.pid).to eq(@library.pid)
|
286
286
|
@book.save
|
287
287
|
|
288
288
|
|
289
|
-
Book.find(@book.pid).library.pid.
|
289
|
+
expect(Book.find(@book.pid).library.pid).to eq(@library.pid)
|
290
290
|
|
291
291
|
end
|
292
292
|
it "should clear the association" do
|
@@ -294,7 +294,7 @@ describe ActiveFedora::Base do
|
|
294
294
|
@book.library = nil
|
295
295
|
@book.save
|
296
296
|
|
297
|
-
Book.find(@book.pid).library.
|
297
|
+
expect(Book.find(@book.pid).library).to be_nil
|
298
298
|
|
299
299
|
end
|
300
300
|
|
@@ -305,7 +305,7 @@ describe ActiveFedora::Base do
|
|
305
305
|
@book.save
|
306
306
|
@book.library = @library2
|
307
307
|
@book.save
|
308
|
-
Book.find(@book.pid).library.pid.
|
308
|
+
expect(Book.find(@book.pid).library.pid).to eq(@library2.pid)
|
309
309
|
|
310
310
|
end
|
311
311
|
|
@@ -320,8 +320,8 @@ describe ActiveFedora::Base do
|
|
320
320
|
@book.publisher = @publisher2
|
321
321
|
@book.save
|
322
322
|
|
323
|
-
Book.find(@book.pid).publisher.pid.
|
324
|
-
Book.find(@book.pid).author.pid.
|
323
|
+
expect(Book.find(@book.pid).publisher.pid).to eq(@publisher2.pid)
|
324
|
+
expect(Book.find(@book.pid).author.pid).to eq(@author.pid)
|
325
325
|
end
|
326
326
|
|
327
327
|
it "should only clear the matching class association" do
|
@@ -332,16 +332,16 @@ describe ActiveFedora::Base do
|
|
332
332
|
@book.author = nil
|
333
333
|
@book.save
|
334
334
|
|
335
|
-
Book.find(@book.pid).author.
|
336
|
-
Book.find(@book.pid).publisher.pid.
|
335
|
+
expect(Book.find(@book.pid).author).to be_nil
|
336
|
+
expect(Book.find(@book.pid).publisher.pid).to eq(@publisher.pid)
|
337
337
|
end
|
338
338
|
|
339
339
|
it "should be able to be set by id" do
|
340
340
|
@book.library_id = @library.pid
|
341
|
-
@book.library_id.
|
342
|
-
@book.library.pid.
|
341
|
+
expect(@book.library_id).to eq(@library.pid)
|
342
|
+
expect(@book.library.pid).to eq(@library.pid)
|
343
343
|
@book.save
|
344
|
-
Book.find(@book.pid).library_id.
|
344
|
+
expect(Book.find(@book.pid).library_id).to eq(@library.pid)
|
345
345
|
end
|
346
346
|
|
347
347
|
after do
|
@@ -381,7 +381,7 @@ describe ActiveFedora::Base do
|
|
381
381
|
|
382
382
|
it "should load the association stored in the parent" do
|
383
383
|
@reloaded_course = Course.find(@course.pid)
|
384
|
-
@reloaded_course.textbooks.
|
384
|
+
expect(@reloaded_course.textbooks).to eq([@t1, @t2])
|
385
385
|
end
|
386
386
|
|
387
387
|
it "should allow a parent to be deleted from the has_many association" do
|
@@ -390,7 +390,7 @@ describe ActiveFedora::Base do
|
|
390
390
|
@reloaded_course.save
|
391
391
|
|
392
392
|
@reloaded_course = Course.find(@course.pid)
|
393
|
-
@reloaded_course.textbooks.
|
393
|
+
expect(@reloaded_course.textbooks).to eq([@t2])
|
394
394
|
end
|
395
395
|
|
396
396
|
it "should allow replacing the children" do
|
@@ -399,7 +399,7 @@ describe ActiveFedora::Base do
|
|
399
399
|
@course.textbooks = [@t3, @t4]
|
400
400
|
@course.save
|
401
401
|
|
402
|
-
@course.reload.textbooks.
|
402
|
+
expect(@course.reload.textbooks).to eq([@t3, @t4])
|
403
403
|
end
|
404
404
|
|
405
405
|
it "should allow a child to be deleted from the has_and_belongs_to_many association" do
|
@@ -409,7 +409,7 @@ describe ActiveFedora::Base do
|
|
409
409
|
@t1.save
|
410
410
|
|
411
411
|
@reloaded_course = Course.find(@course.pid)
|
412
|
-
@reloaded_course.textbooks.
|
412
|
+
expect(@reloaded_course.textbooks).to eq([@t2])
|
413
413
|
end
|
414
414
|
end
|
415
415
|
end
|
@@ -451,7 +451,7 @@ describe ActiveFedora::Base do
|
|
451
451
|
subject.save!
|
452
452
|
end
|
453
453
|
it "should save between the before and after hooks" do
|
454
|
-
subject.
|
454
|
+
expect(subject).to receive(:say_hi).with(@p2).twice
|
455
455
|
subject.pages.delete(@p2)
|
456
456
|
end
|
457
457
|
end
|
@@ -479,7 +479,7 @@ describe ActiveFedora::Base do
|
|
479
479
|
@p2 = subject.pages.build
|
480
480
|
end
|
481
481
|
it "should run the hooks" do
|
482
|
-
subject.
|
482
|
+
expect(subject).to receive(:say_hi).with(@p2)
|
483
483
|
subject.pages.delete(@p2)
|
484
484
|
end
|
485
485
|
end
|
@@ -502,7 +502,7 @@ describe ActiveFedora::Base do
|
|
502
502
|
end
|
503
503
|
|
504
504
|
it "it should find the predicate" do
|
505
|
-
MediaObject.new.association(:baubles).send(:find_predicate).
|
505
|
+
expect(MediaObject.new.association(:baubles).send(:find_predicate)).to eq(:is_part_of)
|
506
506
|
end
|
507
507
|
end
|
508
508
|
|
@@ -521,7 +521,7 @@ describe ActiveFedora::Base do
|
|
521
521
|
end
|
522
522
|
|
523
523
|
it "it should find the predicate" do
|
524
|
-
MediaObject.new.association(:parts).send(:find_predicate).
|
524
|
+
expect(MediaObject.new.association(:parts).send(:find_predicate)).to eq(:is_part_of)
|
525
525
|
end
|
526
526
|
end
|
527
527
|
|
@@ -540,7 +540,7 @@ describe ActiveFedora::Base do
|
|
540
540
|
end
|
541
541
|
|
542
542
|
it "it should find the predicate" do
|
543
|
-
MediaObject.new.association(:baubles).send(:find_predicate).
|
543
|
+
expect(MediaObject.new.association(:baubles).send(:find_predicate)).to eq(:has_baubles)
|
544
544
|
end
|
545
545
|
end
|
546
546
|
describe "an object doesn't have a property" do
|
@@ -601,20 +601,20 @@ describe ActiveFedora::Base do
|
|
601
601
|
book2.contents = [text2, image2]
|
602
602
|
book2.save!
|
603
603
|
|
604
|
-
book1.reload.contents.
|
605
|
-
text1.reload.books.
|
606
|
-
image1.reload.books.
|
604
|
+
expect(book1.reload.contents).to include(text1, image1)
|
605
|
+
expect(text1.reload.books).to eq([book1])
|
606
|
+
expect(image1.reload.books).to eq([book1])
|
607
607
|
|
608
|
-
book2.reload.contents.
|
609
|
-
text2.reload.books.
|
610
|
-
image2.reload.books.
|
608
|
+
expect(book2.reload.contents).to include(text2, image2)
|
609
|
+
expect(text2.reload.books).to eq([book2])
|
610
|
+
expect(image2.reload.books).to eq([book2])
|
611
611
|
end
|
612
612
|
|
613
613
|
it "should work when added via the has_many" do
|
614
614
|
text2.books << book2
|
615
615
|
book2.save
|
616
|
-
book2.reload.contents.
|
617
|
-
text2.reload.books.
|
616
|
+
expect(book2.reload.contents).to eq([text2])
|
617
|
+
expect(text2.reload.books).to eq([book2])
|
618
618
|
end
|
619
619
|
end
|
620
620
|
end
|