active-fedora 11.0.0 → 12.0.0
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 +12 -2
- data/.rubocop_todo.yml +73 -18
- data/.travis.yml +8 -9
- data/CONTRIBUTING.md +66 -20
- data/History.txt +51 -0
- data/README.md +11 -14
- data/active-fedora.gemspec +14 -13
- data/lib/active_fedora/aggregation/base_extension.rb +3 -1
- data/lib/active_fedora/aggregation/list_source.rb +1 -1
- data/lib/active_fedora/associations/association.rb +1 -2
- data/lib/active_fedora/associations/basic_contains_association.rb +12 -0
- data/lib/active_fedora/associations/builder/association.rb +1 -2
- data/lib/active_fedora/associations/collection_association.rb +3 -3
- data/lib/active_fedora/associations/collection_proxy.rb +10 -10
- data/lib/active_fedora/associations/contained_finder.rb +2 -1
- data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +1 -1
- data/lib/active_fedora/associations/null_validator.rb +1 -2
- data/lib/active_fedora/associations/rdf.rb +1 -1
- data/lib/active_fedora/attached_files.rb +4 -0
- data/lib/active_fedora/attribute_methods.rb +1 -1
- data/lib/active_fedora/attributes/property_builder.rb +7 -5
- data/lib/active_fedora/caching_connection.rb +1 -1
- data/lib/active_fedora/cleaner.rb +1 -1
- data/lib/active_fedora/common.rb +10 -0
- data/lib/active_fedora/containers/container.rb +1 -2
- data/lib/active_fedora/core.rb +12 -5
- data/lib/active_fedora/errors.rb +4 -0
- data/lib/active_fedora/fedora.rb +19 -5
- data/lib/active_fedora/file/attributes.rb +5 -0
- data/lib/active_fedora/file.rb +3 -3
- data/lib/active_fedora/file_configurator.rb +5 -5
- data/lib/active_fedora/file_io.rb +120 -0
- data/lib/active_fedora/fixity_service.rb +36 -5
- data/lib/active_fedora/indexers/null_indexer.rb +1 -2
- data/lib/active_fedora/indexing/default_descriptors.rb +128 -0
- data/lib/active_fedora/indexing/descendant_fetcher.rb +105 -0
- data/lib/active_fedora/indexing/descriptor.rb +44 -0
- data/lib/active_fedora/indexing/field_mapper.rb +146 -0
- data/lib/active_fedora/indexing/inserter.rb +40 -0
- data/lib/active_fedora/indexing/map.rb +11 -3
- data/lib/active_fedora/indexing/suffix.rb +81 -0
- data/lib/active_fedora/indexing.rb +39 -15
- data/lib/active_fedora/indexing_service.rb +8 -3
- data/lib/active_fedora/inheritance.rb +1 -1
- data/lib/active_fedora/initializing_connection.rb +1 -1
- data/lib/active_fedora/ldp_resource.rb +1 -2
- data/lib/active_fedora/model_classifier.rb +1 -1
- data/lib/active_fedora/null_logger.rb +13 -0
- data/lib/active_fedora/orders/ordered_list.rb +1 -1
- data/lib/active_fedora/persistence.rb +16 -3
- data/lib/active_fedora/property.rb +1 -2
- data/lib/active_fedora/railtie.rb +6 -2
- data/lib/active_fedora/rake_support.rb +1 -1
- data/lib/active_fedora/rdf/field_map.rb +2 -2
- data/lib/active_fedora/rdf/field_map_entry.rb +15 -7
- data/lib/active_fedora/rdf/indexing_service.rb +15 -13
- data/lib/active_fedora/rdf/value_caster.rb +15 -0
- data/lib/active_fedora/rdf.rb +1 -0
- data/lib/active_fedora/relation/finder_methods.rb +28 -40
- data/lib/active_fedora/solr_hit.rb +1 -1
- data/lib/active_fedora/solr_service.rb +20 -2
- data/lib/active_fedora/type/value.rb +2 -4
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/with_metadata/metadata_node.rb +4 -1
- data/lib/active_fedora.rb +23 -9
- data/lib/generators/active_fedora/config/fedora/templates/.fcrepo_wrapper +1 -1
- data/lib/generators/active_fedora/config/solr/templates/solr/config/schema.xml +0 -6
- data/lib/generators/active_fedora/config/solr/templates/solr.yml +3 -3
- data/spec/integration/associations_spec.rb +8 -8
- data/spec/integration/attached_files_spec.rb +2 -3
- data/spec/integration/base_spec.rb +43 -39
- data/spec/integration/basic_contains_association_spec.rb +16 -3
- data/spec/integration/collection_association_spec.rb +1 -1
- data/spec/integration/direct_container_spec.rb +2 -2
- data/spec/integration/fedora_solr_sync_spec.rb +1 -1
- data/spec/integration/file_spec.rb +46 -13
- data/spec/integration/generators/fedora_generator_spec.rb +1 -1
- data/spec/integration/generators/solr_generator_spec.rb +1 -1
- data/spec/integration/has_and_belongs_to_many_associations_spec.rb +2 -2
- data/spec/integration/has_many_associations_spec.rb +4 -5
- data/spec/integration/indexing/descendant_fetcher_spec.rb +64 -0
- data/spec/integration/indexing_spec.rb +22 -2
- data/spec/integration/indirect_container_spec.rb +2 -2
- data/spec/integration/query_result_builder_spec.rb +2 -2
- data/spec/integration/scoping_spec.rb +20 -14
- data/spec/integration/solr_hit_spec.rb +1 -1
- data/spec/integration/versionable_spec.rb +2 -2
- data/spec/lib/active_fedora/null_logger_spec.rb +10 -0
- data/spec/unit/active_fedora/indexing/inserter_spec.rb +30 -0
- data/spec/unit/attached_files_spec.rb +36 -8
- data/spec/unit/attributes_spec.rb +8 -14
- data/spec/unit/base_spec.rb +7 -7
- data/spec/unit/builder/has_and_belongs_to_many_spec.rb +1 -1
- data/spec/unit/callback_spec.rb +2 -2
- data/spec/unit/change_set_spec.rb +1 -2
- data/spec/unit/collection_proxy_spec.rb +2 -1
- data/spec/unit/core/fedora_id_translator_spec.rb +2 -2
- data/spec/unit/core/fedora_uri_translator_spec.rb +2 -2
- data/spec/unit/core/logger_spec.rb +18 -0
- data/spec/unit/core_spec.rb +46 -12
- data/spec/unit/default_model_mapper_spec.rb +1 -1
- data/spec/unit/fedora_spec.rb +12 -0
- data/spec/unit/file_configurator_spec.rb +0 -9
- data/spec/unit/file_io_spec.rb +137 -0
- data/spec/unit/file_path_builder_spec.rb +3 -3
- data/spec/unit/file_spec.rb +70 -26
- data/spec/unit/files_hash_spec.rb +1 -2
- data/spec/unit/filter_spec.rb +2 -2
- data/spec/unit/finder_methods_spec.rb +1 -1
- data/spec/unit/fixity_service_spec.rb +65 -5
- data/spec/unit/has_and_belongs_to_many_association_spec.rb +1 -2
- data/spec/unit/has_many_association_spec.rb +2 -2
- data/spec/unit/indexing/map/index_object_spec.rb +25 -0
- data/spec/unit/indexing/map_spec.rb +27 -0
- data/spec/unit/indexing_spec.rb +3 -4
- data/spec/unit/inheritance_spec.rb +28 -1
- data/spec/unit/model_classifier_spec.rb +1 -1
- data/spec/unit/pathing_spec.rb +1 -2
- data/spec/unit/query_result_builder_spec.rb +1 -2
- data/spec/unit/query_spec.rb +4 -4
- data/spec/unit/rdf/indexing_service_spec.rb +18 -4
- data/spec/unit/reflection_spec.rb +2 -2
- data/spec/unit/solr_hit_spec.rb +1 -2
- data/spec/unit/solr_service_spec.rb +52 -4
- data/spec/unit/sparql_insert_spec.rb +1 -1
- data/spec/unit/validations_spec.rb +27 -4
- data/spec/unit/with_metadata/metadata_node_spec.rb +26 -1
- metadata +99 -29
data/spec/unit/pathing_spec.rb
CHANGED
|
@@ -2,8 +2,6 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::Base do
|
|
4
4
|
describe ".uri_prefix" do
|
|
5
|
-
let(:path) { "foo" }
|
|
6
|
-
|
|
7
5
|
before do
|
|
8
6
|
class FooHistory < ActiveFedora::Base
|
|
9
7
|
def uri_prefix
|
|
@@ -18,6 +16,7 @@ describe ActiveFedora::Base do
|
|
|
18
16
|
end
|
|
19
17
|
|
|
20
18
|
subject(:history) { FooHistory.new(title: ["Root foo"]) }
|
|
19
|
+
let(:path) { "foo" }
|
|
21
20
|
|
|
22
21
|
it { is_expected.to have_uri_prefix }
|
|
23
22
|
|
|
@@ -5,8 +5,7 @@ describe ActiveFedora::QueryResultBuilder do
|
|
|
5
5
|
before(:all) do
|
|
6
6
|
class AudioRecord < ActiveFedora::Base
|
|
7
7
|
attr_accessor :id
|
|
8
|
-
def self.connection_for_id(_id)
|
|
9
|
-
end
|
|
8
|
+
def self.connection_for_id(_id); end
|
|
10
9
|
end
|
|
11
10
|
@sample_solr_hits = [{ "id" => "my:_ID1_", ActiveFedora.index_field_mapper.solr_name("has_model", :symbol) => ["AudioRecord"] },
|
|
12
11
|
{ "id" => "my:_ID2_", ActiveFedora.index_field_mapper.solr_name("has_model", :symbol) => ["AudioRecord"] },
|
data/spec/unit/query_spec.rb
CHANGED
|
@@ -56,7 +56,7 @@ describe ActiveFedora::Base do
|
|
|
56
56
|
describe "with :cast false" do
|
|
57
57
|
describe "and an id is specified" do
|
|
58
58
|
it "raises an exception if it is not found" do
|
|
59
|
-
expect { SpecModel::Basic.find("_ID_") }.to raise_error ActiveFedora::ObjectNotFoundError
|
|
59
|
+
expect { SpecModel::Basic.find("_ID_") }.to raise_error ActiveFedora::ObjectNotFoundError, "Couldn't find SpecModel::Basic with 'id'=_ID_"
|
|
60
60
|
end
|
|
61
61
|
end
|
|
62
62
|
end
|
|
@@ -242,9 +242,9 @@ describe ActiveFedora::Base do
|
|
|
242
242
|
end
|
|
243
243
|
|
|
244
244
|
describe '#search_with_conditions' do
|
|
245
|
+
subject(:search_with_conditions) { klass.search_with_conditions(conditions) }
|
|
245
246
|
let(:mock_result) { double('Result') }
|
|
246
247
|
let(:klass) { SpecModel::Basic }
|
|
247
|
-
subject(:search_with_conditions) { klass.search_with_conditions(conditions) }
|
|
248
248
|
|
|
249
249
|
before do
|
|
250
250
|
expect(ActiveFedora::SolrService).to receive(:query)
|
|
@@ -298,10 +298,10 @@ describe ActiveFedora::Base do
|
|
|
298
298
|
|
|
299
299
|
describe "#load_from_fedora" do
|
|
300
300
|
let(:relation) { ActiveFedora::Relation.new(described_class) }
|
|
301
|
-
before { @obj = SpecModel::Basic.create(id: "
|
|
301
|
+
before { @obj = SpecModel::Basic.create(id: "test_123") }
|
|
302
302
|
after { @obj.destroy }
|
|
303
303
|
it "casts when klass == ActiveFedora::Base and cast argument is nil" do
|
|
304
|
-
expect(relation.send(:load_from_fedora, "
|
|
304
|
+
expect(relation.send(:load_from_fedora, "test_123", nil)).to be_a SpecModel::Basic
|
|
305
305
|
end
|
|
306
306
|
end
|
|
307
307
|
end
|
|
@@ -20,7 +20,7 @@ describe ActiveFedora::RDF::IndexingService do
|
|
|
20
20
|
MyObj.new.tap do |obj|
|
|
21
21
|
obj.created = [Date.parse("2012-03-04")]
|
|
22
22
|
obj.title = ["Of Mice and Men, The Sequel"]
|
|
23
|
-
obj.publisher = ["Bob's Blogtastic Publishing"]
|
|
23
|
+
obj.publisher = [RDF::Literal.new("Bob's Blogtastic Publishing", language: :fr)]
|
|
24
24
|
obj.based_near = ["Tacoma, WA", "Renton, WA"]
|
|
25
25
|
obj.related_url = ["http://example.org/blogtastic/"]
|
|
26
26
|
obj.rights = ["Totally open, y'all"]
|
|
@@ -50,11 +50,25 @@ describe ActiveFedora::RDF::IndexingService do
|
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
describe "#index_config" do
|
|
54
|
+
subject { indexer.index_config }
|
|
55
|
+
context "without passing one in" do
|
|
56
|
+
before do
|
|
57
|
+
expect(Deprecation).to receive(:warn)
|
|
58
|
+
allow(MyObj).to receive(:index_config).and_return(index_config)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
let(:indexer) { described_class.new(f2) }
|
|
62
|
+
it { is_expected.to eq(index_config) }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
context "when passing one in" do
|
|
66
|
+
let(:indexer) { described_class.new(f2, index_config) }
|
|
67
|
+
it { is_expected.to eq(index_config) }
|
|
68
|
+
end
|
|
55
69
|
end
|
|
56
70
|
|
|
57
|
-
let(:indexer) { described_class.new(f2) }
|
|
71
|
+
let(:indexer) { described_class.new(f2, index_config) }
|
|
58
72
|
|
|
59
73
|
describe "#generate_solr_document" do
|
|
60
74
|
let(:solr_obj) { indexer.generate_solr_document(lambda { |key| "solr_rdf__#{key}" }) }
|
|
@@ -2,10 +2,10 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::Reflection::AssociationReflection do
|
|
4
4
|
describe "#derive_foreign_key" do
|
|
5
|
+
subject { instance.send :derive_foreign_key }
|
|
5
6
|
let(:name) { 'dummy' }
|
|
6
7
|
let(:options) { { inverse_of: :default_permissions } }
|
|
7
8
|
let(:active_fedora) { instance_double(ActiveFedora::Base) }
|
|
8
|
-
subject { instance.send :derive_foreign_key }
|
|
9
9
|
|
|
10
10
|
context "when a has_many" do
|
|
11
11
|
let(:instance) { ActiveFedora::Reflection::HasManyReflection.new(name, nil, options, active_fedora) }
|
|
@@ -26,10 +26,10 @@ describe ActiveFedora::Reflection::AssociationReflection do
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
after { Object.send(:remove_const, :Dummy) }
|
|
29
|
+
subject { instance.send :automatic_inverse_of }
|
|
29
30
|
let(:name) { 'dummy' }
|
|
30
31
|
let(:options) { { as: 'foothing' } }
|
|
31
32
|
let(:active_fedora) { instance_double(ActiveFedora::Base) }
|
|
32
|
-
subject { instance.send :automatic_inverse_of }
|
|
33
33
|
|
|
34
34
|
context "when a has_many" do
|
|
35
35
|
let(:instance) { ActiveFedora::Reflection::HasManyReflection.new(name, nil, options, active_fedora) }
|
data/spec/unit/solr_hit_spec.rb
CHANGED
|
@@ -11,6 +11,12 @@ describe ActiveFedora::SolrService do
|
|
|
11
11
|
|
|
12
12
|
let(:mock_conn) { instance_double(RSolr::Client) }
|
|
13
13
|
|
|
14
|
+
describe '#options' do
|
|
15
|
+
it 'is readable' do
|
|
16
|
+
expect(described_class.instance.options).to include :read_timeout, :open_timeout, :url
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
14
20
|
describe '#conn' do
|
|
15
21
|
it "takes a n-arg constructor and configure for localhost" do
|
|
16
22
|
expect(RSolr).to receive(:connect).with(read_timeout: 120, open_timeout: 120, url: 'http://localhost:8080/solr')
|
|
@@ -59,18 +65,60 @@ describe ActiveFedora::SolrService do
|
|
|
59
65
|
end
|
|
60
66
|
end
|
|
61
67
|
|
|
68
|
+
describe "#post" do
|
|
69
|
+
it "calls solr" do
|
|
70
|
+
stub_result = double("Result")
|
|
71
|
+
expect(mock_conn).to receive(:post).with('select', data: { q: 'querytext', qt: 'standard' }).and_return(stub_result)
|
|
72
|
+
allow(described_class).to receive(:instance).and_return(double("instance", conn: mock_conn))
|
|
73
|
+
expect(described_class.post('querytext')).to eq stub_result
|
|
74
|
+
end
|
|
75
|
+
it "uses select_path" do
|
|
76
|
+
stub_result = double("Result")
|
|
77
|
+
expect(mock_conn).to receive(:post).with('select_test', data: { q: 'querytext', qt: 'standard' }).and_return(stub_result)
|
|
78
|
+
expect(described_class).to receive(:select_path).and_return('select_test')
|
|
79
|
+
allow(described_class).to receive(:instance).and_return(double("instance", conn: mock_conn))
|
|
80
|
+
expect(described_class.post('querytext')).to eq stub_result
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
62
84
|
describe "#query" do
|
|
63
85
|
let(:doc) { { 'id' => 'x' } }
|
|
64
86
|
let(:docs) { [doc] }
|
|
87
|
+
let(:stub_result) { { 'response' => { 'docs' => docs } } }
|
|
65
88
|
|
|
66
|
-
|
|
67
|
-
stub_result = { 'response' => { 'docs' => docs } }
|
|
68
|
-
expect(mock_conn).to receive(:get).with('select', params: { q: 'querytext', qt: 'standard' }).and_return(stub_result)
|
|
89
|
+
before do
|
|
69
90
|
allow(described_class).to receive(:instance).and_return(double("instance", conn: mock_conn))
|
|
70
|
-
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "defaults to HTTP GET method" do
|
|
94
|
+
expect(mock_conn).to receive(:get).with('select', params: { rows: 2, q: 'querytext', qt: 'standard' }).and_return(stub_result)
|
|
95
|
+
described_class.query('querytext', rows: 2)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it "allows callers to specify HTTP POST method" do
|
|
99
|
+
expect(mock_conn).to receive(:post).with('select', data: { rows: 2, q: 'querytext', qt: 'standard' }).and_return(stub_result)
|
|
100
|
+
described_class.query('querytext', rows: 2, method: :post)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "raises if method not GET or POST" do
|
|
104
|
+
expect(mock_conn).not_to receive(:head).with('select', data: { rows: 2, q: 'querytext', qt: 'standard' })
|
|
105
|
+
expect {
|
|
106
|
+
described_class.query('querytext', rows: 2, method: :head)
|
|
107
|
+
}.to raise_error(RuntimeError, "Unsupported HTTP method for querying SolrService (:head)")
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
it "wraps the solr response documents in Solr hits" do
|
|
111
|
+
expect(mock_conn).to receive(:get).with('select', params: { rows: 2, q: 'querytext', qt: 'standard' }).and_return(stub_result)
|
|
112
|
+
result = described_class.query('querytext', rows: 2)
|
|
71
113
|
expect(result.size).to eq 1
|
|
72
114
|
expect(result.first.id).to eq 'x'
|
|
73
115
|
end
|
|
116
|
+
|
|
117
|
+
it "warns about not passing rows" do
|
|
118
|
+
allow(mock_conn).to receive(:get).and_return(stub_result)
|
|
119
|
+
expect(ActiveFedora::Base.logger).to receive(:warn).with(/^Calling ActiveFedora::SolrService\.get without passing an explicit value for ':rows' is not recommended/)
|
|
120
|
+
described_class.query('querytext')
|
|
121
|
+
end
|
|
74
122
|
end
|
|
75
123
|
|
|
76
124
|
describe ".count" do
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::SparqlInsert do
|
|
4
|
-
let(:change_set) { ActiveFedora::ChangeSet.new(base, base.resource, base.changed_attributes.keys) }
|
|
5
4
|
subject(:sparql_insert) { described_class.new(change_set.changes) }
|
|
5
|
+
let(:change_set) { ActiveFedora::ChangeSet.new(base, base.resource, base.changed_attributes.keys) }
|
|
6
6
|
|
|
7
7
|
context "with a changed object" do
|
|
8
8
|
before do
|
|
@@ -22,7 +22,7 @@ describe ActiveFedora::Base do
|
|
|
22
22
|
validation_stub.attributes = { fubar: ['here'], swank: 'long enough' }
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
it {
|
|
25
|
+
it { is_expected.to be_valid }
|
|
26
26
|
end
|
|
27
27
|
describe "an invalid object" do
|
|
28
28
|
before do
|
|
@@ -36,16 +36,39 @@ describe ActiveFedora::Base do
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
describe "required terms" do
|
|
39
|
-
it {
|
|
40
|
-
it {
|
|
39
|
+
it { is_expected.to be_required(:fubar) }
|
|
40
|
+
it { is_expected.to_not be_required(:swank) }
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
describe "#save!" do
|
|
44
|
-
before {
|
|
44
|
+
before { expect(validation_stub).to receive(:_create_record) } # prevent saving to Fedora/Solr
|
|
45
45
|
|
|
46
46
|
it "validates only once" do
|
|
47
47
|
expect(validation_stub).to receive(:perform_validations).once.and_return(true)
|
|
48
48
|
validation_stub.save!
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
describe "#update!" do
|
|
53
|
+
before do
|
|
54
|
+
allow(validation_stub).to receive(:new_record?).and_return(false)
|
|
55
|
+
end
|
|
56
|
+
context "when validations work" do
|
|
57
|
+
it "saves the record" do
|
|
58
|
+
expect(validation_stub).to receive(:_update_record) # prevent saving to Fedora/Solr
|
|
59
|
+
expect(validation_stub).to receive(:perform_validations).once.and_return(true)
|
|
60
|
+
validation_stub.update!(fubar: ['here'], swank: 'long enough')
|
|
61
|
+
expect(validation_stub.fubar).to eq ['here']
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
context "when validations fail" do
|
|
66
|
+
it "raises an error" do
|
|
67
|
+
expect(validation_stub).not_to receive(:_update_record)
|
|
68
|
+
expect(validation_stub).to receive(:perform_validations).once.and_return(false)
|
|
69
|
+
expect { validation_stub.update!(fubar: ['here'], swank: 'long enough') }.to raise_error ActiveFedora::RecordInvalid
|
|
70
|
+
expect(validation_stub.fubar).to eq ['here']
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
51
74
|
end
|
|
@@ -24,8 +24,8 @@ describe ActiveFedora::WithMetadata::MetadataNode do
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
describe "changes_for_update" do
|
|
27
|
-
let(:changes_for_update) { node.send(:changes_for_update) }
|
|
28
27
|
subject { changes_for_update }
|
|
28
|
+
let(:changes_for_update) { node.send(:changes_for_update) }
|
|
29
29
|
|
|
30
30
|
context "when type is not set" do
|
|
31
31
|
it { is_expected.to eq({}) }
|
|
@@ -41,4 +41,29 @@ describe ActiveFedora::WithMetadata::MetadataNode do
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
|
+
|
|
45
|
+
describe ".new" do
|
|
46
|
+
it "does not make a request when parent file is new" do
|
|
47
|
+
expect(file.ldp_source.client).not_to receive(:head)
|
|
48
|
+
described_class.new(file)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
describe ".save" do
|
|
53
|
+
it "resets metadata_uri" do
|
|
54
|
+
expect(node.metadata_uri).to eq ::RDF::URI.new(nil)
|
|
55
|
+
file.content = "test"
|
|
56
|
+
file.save!
|
|
57
|
+
node.save
|
|
58
|
+
expect(node.metadata_uri).not_to eq ::RDF::URI.new(nil)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "resets ldp_source" do
|
|
62
|
+
expect(node.ldp_source.new?).to be_truthy
|
|
63
|
+
file.content = "test"
|
|
64
|
+
file.save!
|
|
65
|
+
node.save
|
|
66
|
+
expect(node.ldp_source.new?).to be_falsey
|
|
67
|
+
end
|
|
68
|
+
end
|
|
44
69
|
end
|
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:
|
|
4
|
+
version: 12.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Zumwalt
|
|
@@ -10,42 +10,48 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rsolr
|
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
|
18
18
|
requirements:
|
|
19
|
-
- - "~>"
|
|
20
|
-
- !ruby/object:Gem::Version
|
|
21
|
-
version: '1.1'
|
|
22
19
|
- - ">="
|
|
23
20
|
- !ruby/object:Gem::Version
|
|
24
21
|
version: 1.1.2
|
|
22
|
+
- - "<"
|
|
23
|
+
- !ruby/object:Gem::Version
|
|
24
|
+
version: '3'
|
|
25
25
|
type: :runtime
|
|
26
26
|
prerelease: false
|
|
27
27
|
version_requirements: !ruby/object:Gem::Requirement
|
|
28
28
|
requirements:
|
|
29
|
-
- - "~>"
|
|
30
|
-
- !ruby/object:Gem::Version
|
|
31
|
-
version: '1.1'
|
|
32
29
|
- - ">="
|
|
33
30
|
- !ruby/object:Gem::Version
|
|
34
31
|
version: 1.1.2
|
|
32
|
+
- - "<"
|
|
33
|
+
- !ruby/object:Gem::Version
|
|
34
|
+
version: '3'
|
|
35
35
|
- !ruby/object:Gem::Dependency
|
|
36
36
|
name: solrizer
|
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
|
-
- - "
|
|
39
|
+
- - ">="
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
41
|
version: '3.4'
|
|
42
|
+
- - "<"
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: '5'
|
|
42
45
|
type: :runtime
|
|
43
46
|
prerelease: false
|
|
44
47
|
version_requirements: !ruby/object:Gem::Requirement
|
|
45
48
|
requirements:
|
|
46
|
-
- - "
|
|
49
|
+
- - ">="
|
|
47
50
|
- !ruby/object:Gem::Version
|
|
48
51
|
version: '3.4'
|
|
52
|
+
- - "<"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '5'
|
|
49
55
|
- !ruby/object:Gem::Dependency
|
|
50
56
|
name: activesupport
|
|
51
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -90,16 +96,22 @@ dependencies:
|
|
|
90
96
|
name: active-triples
|
|
91
97
|
requirement: !ruby/object:Gem::Requirement
|
|
92
98
|
requirements:
|
|
93
|
-
- - "
|
|
99
|
+
- - ">="
|
|
94
100
|
- !ruby/object:Gem::Version
|
|
95
101
|
version: 0.11.0
|
|
102
|
+
- - "<"
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: 2.0.0
|
|
96
105
|
type: :runtime
|
|
97
106
|
prerelease: false
|
|
98
107
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
108
|
requirements:
|
|
100
|
-
- - "
|
|
109
|
+
- - ">="
|
|
101
110
|
- !ruby/object:Gem::Version
|
|
102
111
|
version: 0.11.0
|
|
112
|
+
- - "<"
|
|
113
|
+
- !ruby/object:Gem::Version
|
|
114
|
+
version: 2.0.0
|
|
103
115
|
- !ruby/object:Gem::Dependency
|
|
104
116
|
name: deprecation
|
|
105
117
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -120,14 +132,56 @@ dependencies:
|
|
|
120
132
|
requirements:
|
|
121
133
|
- - "~>"
|
|
122
134
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: 0.
|
|
135
|
+
version: 0.7.0
|
|
124
136
|
type: :runtime
|
|
125
137
|
prerelease: false
|
|
126
138
|
version_requirements: !ruby/object:Gem::Requirement
|
|
127
139
|
requirements:
|
|
128
140
|
- - "~>"
|
|
129
141
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: 0.
|
|
142
|
+
version: 0.7.0
|
|
143
|
+
- !ruby/object:Gem::Dependency
|
|
144
|
+
name: ruby-progressbar
|
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
|
146
|
+
requirements:
|
|
147
|
+
- - "~>"
|
|
148
|
+
- !ruby/object:Gem::Version
|
|
149
|
+
version: '1.0'
|
|
150
|
+
type: :runtime
|
|
151
|
+
prerelease: false
|
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
153
|
+
requirements:
|
|
154
|
+
- - "~>"
|
|
155
|
+
- !ruby/object:Gem::Version
|
|
156
|
+
version: '1.0'
|
|
157
|
+
- !ruby/object:Gem::Dependency
|
|
158
|
+
name: faraday
|
|
159
|
+
requirement: !ruby/object:Gem::Requirement
|
|
160
|
+
requirements:
|
|
161
|
+
- - "~>"
|
|
162
|
+
- !ruby/object:Gem::Version
|
|
163
|
+
version: 0.12.1
|
|
164
|
+
type: :runtime
|
|
165
|
+
prerelease: false
|
|
166
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
167
|
+
requirements:
|
|
168
|
+
- - "~>"
|
|
169
|
+
- !ruby/object:Gem::Version
|
|
170
|
+
version: 0.12.1
|
|
171
|
+
- !ruby/object:Gem::Dependency
|
|
172
|
+
name: faraday-encoding
|
|
173
|
+
requirement: !ruby/object:Gem::Requirement
|
|
174
|
+
requirements:
|
|
175
|
+
- - '='
|
|
176
|
+
- !ruby/object:Gem::Version
|
|
177
|
+
version: 0.0.4
|
|
178
|
+
type: :runtime
|
|
179
|
+
prerelease: false
|
|
180
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
181
|
+
requirements:
|
|
182
|
+
- - '='
|
|
183
|
+
- !ruby/object:Gem::Version
|
|
184
|
+
version: 0.0.4
|
|
131
185
|
- !ruby/object:Gem::Dependency
|
|
132
186
|
name: rails
|
|
133
187
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -174,30 +228,30 @@ dependencies:
|
|
|
174
228
|
name: rake
|
|
175
229
|
requirement: !ruby/object:Gem::Requirement
|
|
176
230
|
requirements:
|
|
177
|
-
- - "
|
|
231
|
+
- - ">="
|
|
178
232
|
- !ruby/object:Gem::Version
|
|
179
|
-
version: '
|
|
233
|
+
version: '0'
|
|
180
234
|
type: :development
|
|
181
235
|
prerelease: false
|
|
182
236
|
version_requirements: !ruby/object:Gem::Requirement
|
|
183
237
|
requirements:
|
|
184
|
-
- - "
|
|
238
|
+
- - ">="
|
|
185
239
|
- !ruby/object:Gem::Version
|
|
186
|
-
version: '
|
|
240
|
+
version: '0'
|
|
187
241
|
- !ruby/object:Gem::Dependency
|
|
188
242
|
name: solr_wrapper
|
|
189
243
|
requirement: !ruby/object:Gem::Requirement
|
|
190
244
|
requirements:
|
|
191
245
|
- - "~>"
|
|
192
246
|
- !ruby/object:Gem::Version
|
|
193
|
-
version: '0
|
|
247
|
+
version: '1.0'
|
|
194
248
|
type: :development
|
|
195
249
|
prerelease: false
|
|
196
250
|
version_requirements: !ruby/object:Gem::Requirement
|
|
197
251
|
requirements:
|
|
198
252
|
- - "~>"
|
|
199
253
|
- !ruby/object:Gem::Version
|
|
200
|
-
version: '0
|
|
254
|
+
version: '1.0'
|
|
201
255
|
- !ruby/object:Gem::Dependency
|
|
202
256
|
name: fcrepo_wrapper
|
|
203
257
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -218,14 +272,14 @@ dependencies:
|
|
|
218
272
|
requirements:
|
|
219
273
|
- - "~>"
|
|
220
274
|
- !ruby/object:Gem::Version
|
|
221
|
-
version: '3.
|
|
275
|
+
version: '3.5'
|
|
222
276
|
type: :development
|
|
223
277
|
prerelease: false
|
|
224
278
|
version_requirements: !ruby/object:Gem::Requirement
|
|
225
279
|
requirements:
|
|
226
280
|
- - "~>"
|
|
227
281
|
- !ruby/object:Gem::Version
|
|
228
|
-
version: '3.
|
|
282
|
+
version: '3.5'
|
|
229
283
|
- !ruby/object:Gem::Dependency
|
|
230
284
|
name: rspec-its
|
|
231
285
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -274,32 +328,32 @@ dependencies:
|
|
|
274
328
|
requirements:
|
|
275
329
|
- - "~>"
|
|
276
330
|
- !ruby/object:Gem::Version
|
|
277
|
-
version: 0.
|
|
331
|
+
version: 0.47.1
|
|
278
332
|
type: :development
|
|
279
333
|
prerelease: false
|
|
280
334
|
version_requirements: !ruby/object:Gem::Requirement
|
|
281
335
|
requirements:
|
|
282
336
|
- - "~>"
|
|
283
337
|
- !ruby/object:Gem::Version
|
|
284
|
-
version: 0.
|
|
338
|
+
version: 0.47.1
|
|
285
339
|
- !ruby/object:Gem::Dependency
|
|
286
340
|
name: rubocop-rspec
|
|
287
341
|
requirement: !ruby/object:Gem::Requirement
|
|
288
342
|
requirements:
|
|
289
343
|
- - "~>"
|
|
290
344
|
- !ruby/object:Gem::Version
|
|
291
|
-
version:
|
|
345
|
+
version: 1.12.0
|
|
292
346
|
type: :development
|
|
293
347
|
prerelease: false
|
|
294
348
|
version_requirements: !ruby/object:Gem::Requirement
|
|
295
349
|
requirements:
|
|
296
350
|
- - "~>"
|
|
297
351
|
- !ruby/object:Gem::Version
|
|
298
|
-
version:
|
|
352
|
+
version: 1.12.0
|
|
299
353
|
description: ActiveFedora provides for creating and managing objects in the Fedora
|
|
300
354
|
Repository Architecture.
|
|
301
355
|
email:
|
|
302
|
-
-
|
|
356
|
+
- samvera-tech@googlegroups.com
|
|
303
357
|
executables: []
|
|
304
358
|
extensions: []
|
|
305
359
|
extra_rdoc_files:
|
|
@@ -412,6 +466,7 @@ files:
|
|
|
412
466
|
- lib/active_fedora/file/attributes.rb
|
|
413
467
|
- lib/active_fedora/file/streaming.rb
|
|
414
468
|
- lib/active_fedora/file_configurator.rb
|
|
469
|
+
- lib/active_fedora/file_io.rb
|
|
415
470
|
- lib/active_fedora/file_path_builder.rb
|
|
416
471
|
- lib/active_fedora/file_persistence.rb
|
|
417
472
|
- lib/active_fedora/file_relation.rb
|
|
@@ -423,7 +478,13 @@ files:
|
|
|
423
478
|
- lib/active_fedora/indexers/global_indexer.rb
|
|
424
479
|
- lib/active_fedora/indexers/null_indexer.rb
|
|
425
480
|
- lib/active_fedora/indexing.rb
|
|
481
|
+
- lib/active_fedora/indexing/default_descriptors.rb
|
|
482
|
+
- lib/active_fedora/indexing/descendant_fetcher.rb
|
|
483
|
+
- lib/active_fedora/indexing/descriptor.rb
|
|
484
|
+
- lib/active_fedora/indexing/field_mapper.rb
|
|
485
|
+
- lib/active_fedora/indexing/inserter.rb
|
|
426
486
|
- lib/active_fedora/indexing/map.rb
|
|
487
|
+
- lib/active_fedora/indexing/suffix.rb
|
|
427
488
|
- lib/active_fedora/indexing_service.rb
|
|
428
489
|
- lib/active_fedora/inheritable_accessors.rb
|
|
429
490
|
- lib/active_fedora/inheritance.rb
|
|
@@ -436,6 +497,7 @@ files:
|
|
|
436
497
|
- lib/active_fedora/log_subscriber.rb
|
|
437
498
|
- lib/active_fedora/model_classifier.rb
|
|
438
499
|
- lib/active_fedora/nested_attributes.rb
|
|
500
|
+
- lib/active_fedora/null_logger.rb
|
|
439
501
|
- lib/active_fedora/null_relation.rb
|
|
440
502
|
- lib/active_fedora/orders.rb
|
|
441
503
|
- lib/active_fedora/orders/collection_proxy.rb
|
|
@@ -456,6 +518,7 @@ files:
|
|
|
456
518
|
- lib/active_fedora/rdf/indexing_service.rb
|
|
457
519
|
- lib/active_fedora/rdf/persistence.rb
|
|
458
520
|
- lib/active_fedora/rdf/project_hydra.rb
|
|
521
|
+
- lib/active_fedora/rdf/value_caster.rb
|
|
459
522
|
- lib/active_fedora/reflection.rb
|
|
460
523
|
- lib/active_fedora/relation.rb
|
|
461
524
|
- lib/active_fedora/relation/calculations.rb
|
|
@@ -564,6 +627,7 @@ files:
|
|
|
564
627
|
- spec/integration/has_and_belongs_to_many_associations_spec.rb
|
|
565
628
|
- spec/integration/has_many_associations_spec.rb
|
|
566
629
|
- spec/integration/has_subresource_spec.rb
|
|
630
|
+
- spec/integration/indexing/descendant_fetcher_spec.rb
|
|
567
631
|
- spec/integration/indexing_spec.rb
|
|
568
632
|
- spec/integration/indirect_container_spec.rb
|
|
569
633
|
- spec/integration/json_serialization_spec.rb
|
|
@@ -580,10 +644,12 @@ files:
|
|
|
580
644
|
- spec/integration/solr_hit_spec.rb
|
|
581
645
|
- spec/integration/versionable_spec.rb
|
|
582
646
|
- spec/integration/with_metadata_spec.rb
|
|
647
|
+
- spec/lib/active_fedora/null_logger_spec.rb
|
|
583
648
|
- spec/rcov.opts
|
|
584
649
|
- spec/spec.opts
|
|
585
650
|
- spec/spec_helper.rb
|
|
586
651
|
- spec/support/an_active_model.rb
|
|
652
|
+
- spec/unit/active_fedora/indexing/inserter_spec.rb
|
|
587
653
|
- spec/unit/active_fedora_spec.rb
|
|
588
654
|
- spec/unit/aggregation/list_source_spec.rb
|
|
589
655
|
- spec/unit/aggregation/ordered_reader_spec.rb
|
|
@@ -603,11 +669,13 @@ files:
|
|
|
603
669
|
- spec/unit/config_spec.rb
|
|
604
670
|
- spec/unit/core/fedora_id_translator_spec.rb
|
|
605
671
|
- spec/unit/core/fedora_uri_translator_spec.rb
|
|
672
|
+
- spec/unit/core/logger_spec.rb
|
|
606
673
|
- spec/unit/core_spec.rb
|
|
607
674
|
- spec/unit/default_model_mapper_spec.rb
|
|
608
675
|
- spec/unit/fedora_spec.rb
|
|
609
676
|
- spec/unit/file/streaming_spec.rb
|
|
610
677
|
- spec/unit/file_configurator_spec.rb
|
|
678
|
+
- spec/unit/file_io_spec.rb
|
|
611
679
|
- spec/unit/file_path_builder_spec.rb
|
|
612
680
|
- spec/unit/file_spec.rb
|
|
613
681
|
- spec/unit/files_hash_spec.rb
|
|
@@ -618,6 +686,8 @@ files:
|
|
|
618
686
|
- spec/unit/has_and_belongs_to_many_association_spec.rb
|
|
619
687
|
- spec/unit/has_many_association_spec.rb
|
|
620
688
|
- spec/unit/indexers/global_indexer_spec.rb
|
|
689
|
+
- spec/unit/indexing/map/index_object_spec.rb
|
|
690
|
+
- spec/unit/indexing/map_spec.rb
|
|
621
691
|
- spec/unit/indexing_service_spec.rb
|
|
622
692
|
- spec/unit/indexing_spec.rb
|
|
623
693
|
- spec/unit/inheritance_spec.rb
|
|
@@ -656,7 +726,7 @@ files:
|
|
|
656
726
|
- spec/unit/with_metadata/metadata_node_spec.rb
|
|
657
727
|
homepage: https://github.com/projecthydra/active_fedora
|
|
658
728
|
licenses:
|
|
659
|
-
-
|
|
729
|
+
- Apache-2.0
|
|
660
730
|
metadata: {}
|
|
661
731
|
post_install_message:
|
|
662
732
|
rdoc_options: []
|
|
@@ -674,7 +744,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
674
744
|
version: '0'
|
|
675
745
|
requirements: []
|
|
676
746
|
rubyforge_project:
|
|
677
|
-
rubygems_version: 2.
|
|
747
|
+
rubygems_version: 2.6.13
|
|
678
748
|
signing_key:
|
|
679
749
|
specification_version: 4
|
|
680
750
|
summary: A convenience libary for manipulating documents in the Fedora Repository.
|