active-fedora 9.10.0.pre1 → 9.10.0.pre2
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/.rubocop.yml +7 -0
- data/lib/active_fedora.rb +4 -0
- data/lib/active_fedora/associations/collection_association.rb +7 -7
- data/lib/active_fedora/attribute_assignment.rb +55 -0
- data/lib/active_fedora/attribute_methods.rb +149 -47
- data/lib/active_fedora/attribute_methods/read.rb +29 -44
- data/lib/active_fedora/attribute_methods/write.rb +16 -19
- data/lib/active_fedora/attributes.rb +5 -17
- data/lib/active_fedora/base.rb +2 -0
- data/lib/active_fedora/callbacks.rb +9 -9
- data/lib/active_fedora/common.rb +67 -0
- data/lib/active_fedora/core.rb +9 -22
- data/lib/active_fedora/errors.rb +29 -0
- data/lib/active_fedora/file.rb +5 -57
- data/lib/active_fedora/file_persistence.rb +27 -0
- data/lib/active_fedora/identifiable.rb +0 -5
- data/lib/active_fedora/indexing.rb +2 -2
- data/lib/active_fedora/inheritance.rb +34 -0
- data/lib/active_fedora/persistence.rb +22 -4
- data/lib/active_fedora/scoping.rb +80 -2
- data/lib/active_fedora/scoping/default.rb +6 -2
- data/lib/active_fedora/scoping/named.rb +141 -1
- data/lib/active_fedora/version.rb +1 -1
- data/spec/integration/collection_association_spec.rb +34 -3
- data/spec/integration/file_spec.rb +1 -1
- data/spec/integration/persistence_spec.rb +1 -1
- data/spec/unit/attributes_spec.rb +13 -7
- data/spec/unit/file_spec.rb +2 -2
- data/spec/unit/validations_spec.rb +1 -1
- metadata +6 -2
@@ -7,7 +7,7 @@ describe "persisting objects" do
|
|
7
7
|
has_metadata type: ActiveFedora::SimpleDatastream, name: "foo" do |m|
|
8
8
|
m.field "name", :string
|
9
9
|
end
|
10
|
-
property :name,
|
10
|
+
property :name, predicate: ::RDF::Vocab::DC.title, multiple: false
|
11
11
|
validates :name, presence: true
|
12
12
|
end
|
13
13
|
end
|
@@ -38,7 +38,9 @@ describe ActiveFedora::Base do
|
|
38
38
|
before do
|
39
39
|
class BarHistory4 < ActiveFedora::Base
|
40
40
|
has_metadata type: BarStream2, name: "xmlish"
|
41
|
-
|
41
|
+
Deprecation.silence(ActiveFedora::Attributes) do
|
42
|
+
property :cow, delegate_to: 'xmlish'
|
43
|
+
end
|
42
44
|
end
|
43
45
|
end
|
44
46
|
after do
|
@@ -63,7 +65,9 @@ describe ActiveFedora::Base do
|
|
63
65
|
before do
|
64
66
|
class BarHistory4 < ActiveFedora::Base
|
65
67
|
has_metadata type: BarStream2, name: "xmlish"
|
66
|
-
|
68
|
+
Deprecation.silence(ActiveFedora::Attributes) do
|
69
|
+
property :cow, delegate_to: 'xmlish', multiple: false
|
70
|
+
end
|
67
71
|
end
|
68
72
|
end
|
69
73
|
after do
|
@@ -83,7 +87,9 @@ describe ActiveFedora::Base do
|
|
83
87
|
before do
|
84
88
|
class BarHistory4 < ActiveFedora::Base
|
85
89
|
has_metadata type: BarStream2, name: "xmlish"
|
86
|
-
|
90
|
+
Deprecation.silence(ActiveFedora::Attributes) do
|
91
|
+
property :cow, delegate_to: 'xmlish', multiple: false
|
92
|
+
end
|
87
93
|
end
|
88
94
|
end
|
89
95
|
after do
|
@@ -294,17 +300,17 @@ describe ActiveFedora::Base do
|
|
294
300
|
end
|
295
301
|
|
296
302
|
it "raises an error on the reader when the field isn't delegated" do
|
297
|
-
expect { subject['donkey'] }.to raise_error ActiveFedora::UnknownAttributeError, "
|
303
|
+
expect { subject['donkey'] }.to raise_error ActiveFedora::UnknownAttributeError, "unknown attribute 'donkey' for BarHistory2."
|
298
304
|
end
|
299
305
|
|
300
306
|
it "raises an error on the setter when the field isn't delegated" do
|
301
|
-
expect { subject['donkey'] = "bray" }.to raise_error ActiveFedora::UnknownAttributeError, "
|
307
|
+
expect { subject['donkey'] = "bray" }.to raise_error ActiveFedora::UnknownAttributeError, "unknown attribute 'donkey' for BarHistory2."
|
302
308
|
end
|
303
309
|
end
|
304
310
|
|
305
311
|
describe "attributes=" do
|
306
312
|
it "raises an error on an invalid attribute" do
|
307
|
-
expect { subject.attributes = { 'donkey' => "bray" } }.to raise_error ActiveFedora::UnknownAttributeError, "
|
313
|
+
expect { subject.attributes = { 'donkey' => "bray" } }.to raise_error ActiveFedora::UnknownAttributeError, "unknown attribute 'donkey' for BarHistory2."
|
308
314
|
end
|
309
315
|
end
|
310
316
|
|
@@ -330,7 +336,7 @@ describe ActiveFedora::Base do
|
|
330
336
|
end
|
331
337
|
|
332
338
|
it 'raises an error if the attribute does not exist' do
|
333
|
-
expect { BarHistory2.multiple?(:arbitrary_nonexistent_attribute) }.to raise_error ActiveFedora::UnknownAttributeError, "
|
339
|
+
expect { BarHistory2.multiple?(:arbitrary_nonexistent_attribute) }.to raise_error ActiveFedora::UnknownAttributeError, "unknown attribute 'arbitrary_nonexistent_attribute' for BarHistory2."
|
334
340
|
end
|
335
341
|
end
|
336
342
|
|
data/spec/unit/file_spec.rb
CHANGED
@@ -379,9 +379,9 @@ describe ActiveFedora::File do
|
|
379
379
|
subject.content = "foo"
|
380
380
|
subject.save
|
381
381
|
expect(subject).to receive(:b_save).once
|
382
|
-
expect(subject).
|
382
|
+
expect(subject).to receive(:a_save)
|
383
383
|
expect(subject).to receive(:b_update).once
|
384
|
-
expect(subject).
|
384
|
+
expect(subject).to receive(:a_update)
|
385
385
|
subject.save
|
386
386
|
}
|
387
387
|
end
|
@@ -47,7 +47,7 @@ describe ActiveFedora::Base do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "#save!" do
|
50
|
-
before { allow(subject).to receive(:
|
50
|
+
before { allow(subject).to receive(:_create_record) } # prevent saving to Fedora/Solr
|
51
51
|
|
52
52
|
it "validates only once" do
|
53
53
|
expect(subject).to receive(:perform_validations).once.and_return(true)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active-fedora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.10.0.
|
4
|
+
version: 9.10.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zumwalt
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-03-
|
13
|
+
date: 2016-03-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rsolr
|
@@ -405,6 +405,7 @@ files:
|
|
405
405
|
- lib/active_fedora/associations/singular_association.rb
|
406
406
|
- lib/active_fedora/associations/singular_rdf.rb
|
407
407
|
- lib/active_fedora/attached_files.rb
|
408
|
+
- lib/active_fedora/attribute_assignment.rb
|
408
409
|
- lib/active_fedora/attribute_methods.rb
|
409
410
|
- lib/active_fedora/attribute_methods/dirty.rb
|
410
411
|
- lib/active_fedora/attribute_methods/read.rb
|
@@ -426,6 +427,7 @@ files:
|
|
426
427
|
- lib/active_fedora/checksum.rb
|
427
428
|
- lib/active_fedora/clean_connection.rb
|
428
429
|
- lib/active_fedora/cleaner.rb
|
430
|
+
- lib/active_fedora/common.rb
|
429
431
|
- lib/active_fedora/config.rb
|
430
432
|
- lib/active_fedora/containers/container.rb
|
431
433
|
- lib/active_fedora/containers/direct_container.rb
|
@@ -446,6 +448,7 @@ files:
|
|
446
448
|
- lib/active_fedora/file/streaming.rb
|
447
449
|
- lib/active_fedora/file_configurator.rb
|
448
450
|
- lib/active_fedora/file_path_builder.rb
|
451
|
+
- lib/active_fedora/file_persistence.rb
|
449
452
|
- lib/active_fedora/file_relation.rb
|
450
453
|
- lib/active_fedora/files_hash.rb
|
451
454
|
- lib/active_fedora/fixity_service.rb
|
@@ -458,6 +461,7 @@ files:
|
|
458
461
|
- lib/active_fedora/indexing/map.rb
|
459
462
|
- lib/active_fedora/indexing_service.rb
|
460
463
|
- lib/active_fedora/inheritable_accessors.rb
|
464
|
+
- lib/active_fedora/inheritance.rb
|
461
465
|
- lib/active_fedora/ldp_cache.rb
|
462
466
|
- lib/active_fedora/ldp_resource.rb
|
463
467
|
- lib/active_fedora/ldp_resource_service.rb
|