active-fedora 11.1.3 → 11.2.1

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.
Files changed (79) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +3 -2
  3. data/.rubocop_todo.yml +73 -18
  4. data/.travis.yml +4 -4
  5. data/History.txt +6 -0
  6. data/README.md +1 -1
  7. data/active-fedora.gemspec +5 -4
  8. data/lib/active_fedora.rb +3 -3
  9. data/lib/active_fedora/aggregation/list_source.rb +1 -1
  10. data/lib/active_fedora/associations/association.rb +1 -2
  11. data/lib/active_fedora/associations/basic_contains_association.rb +3 -1
  12. data/lib/active_fedora/associations/builder/association.rb +1 -2
  13. data/lib/active_fedora/associations/null_validator.rb +1 -2
  14. data/lib/active_fedora/attached_files.rb +4 -0
  15. data/lib/active_fedora/attributes/property_builder.rb +3 -3
  16. data/lib/active_fedora/containers/container.rb +1 -2
  17. data/lib/active_fedora/file.rb +2 -3
  18. data/lib/active_fedora/file_configurator.rb +2 -2
  19. data/lib/active_fedora/fixity_service.rb +36 -5
  20. data/lib/active_fedora/indexers/null_indexer.rb +1 -2
  21. data/lib/active_fedora/indexing.rb +34 -15
  22. data/lib/active_fedora/indexing/descendant_fetcher.rb +101 -0
  23. data/lib/active_fedora/indexing/map.rb +11 -3
  24. data/lib/active_fedora/indexing_service.rb +6 -1
  25. data/lib/active_fedora/inheritance.rb +1 -1
  26. data/lib/active_fedora/null_logger.rb +2 -4
  27. data/lib/active_fedora/persistence.rb +2 -2
  28. data/lib/active_fedora/property.rb +1 -2
  29. data/lib/active_fedora/rake_support.rb +1 -1
  30. data/lib/active_fedora/rdf/field_map.rb +2 -2
  31. data/lib/active_fedora/rdf/field_map_entry.rb +7 -5
  32. data/lib/active_fedora/rdf/indexing_service.rb +9 -7
  33. data/lib/active_fedora/relation/finder_methods.rb +2 -1
  34. data/lib/active_fedora/solr_service.rb +2 -1
  35. data/lib/active_fedora/type/value.rb +2 -4
  36. data/lib/active_fedora/version.rb +1 -1
  37. data/lib/active_fedora/with_metadata/metadata_node.rb +2 -0
  38. data/spec/integration/associations_spec.rb +8 -8
  39. data/spec/integration/attached_files_spec.rb +1 -2
  40. data/spec/integration/collection_association_spec.rb +1 -1
  41. data/spec/integration/direct_container_spec.rb +2 -2
  42. data/spec/integration/fedora_solr_sync_spec.rb +1 -1
  43. data/spec/integration/generators/fedora_generator_spec.rb +1 -1
  44. data/spec/integration/generators/solr_generator_spec.rb +1 -1
  45. data/spec/integration/has_many_associations_spec.rb +4 -5
  46. data/spec/integration/indexing_spec.rb +21 -1
  47. data/spec/integration/indirect_container_spec.rb +2 -2
  48. data/spec/integration/solr_hit_spec.rb +1 -1
  49. data/spec/integration/versionable_spec.rb +2 -2
  50. data/spec/unit/attached_files_spec.rb +36 -8
  51. data/spec/unit/attributes_spec.rb +5 -13
  52. data/spec/unit/base_spec.rb +2 -2
  53. data/spec/unit/callback_spec.rb +2 -2
  54. data/spec/unit/change_set_spec.rb +1 -2
  55. data/spec/unit/collection_proxy_spec.rb +2 -1
  56. data/spec/unit/core_spec.rb +3 -3
  57. data/spec/unit/default_model_mapper_spec.rb +1 -1
  58. data/spec/unit/file_path_builder_spec.rb +1 -1
  59. data/spec/unit/file_spec.rb +23 -25
  60. data/spec/unit/files_hash_spec.rb +1 -2
  61. data/spec/unit/filter_spec.rb +2 -2
  62. data/spec/unit/fixity_service_spec.rb +65 -5
  63. data/spec/unit/has_and_belongs_to_many_association_spec.rb +1 -2
  64. data/spec/unit/has_many_association_spec.rb +2 -2
  65. data/spec/unit/indexing/map/index_object_spec.rb +25 -0
  66. data/spec/unit/indexing/map_spec.rb +27 -0
  67. data/spec/unit/indexing_spec.rb +1 -2
  68. data/spec/unit/inheritance_spec.rb +28 -1
  69. data/spec/unit/model_classifier_spec.rb +1 -1
  70. data/spec/unit/pathing_spec.rb +1 -2
  71. data/spec/unit/query_result_builder_spec.rb +1 -2
  72. data/spec/unit/query_spec.rb +1 -1
  73. data/spec/unit/rdf/indexing_service_spec.rb +17 -3
  74. data/spec/unit/reflection_spec.rb +2 -2
  75. data/spec/unit/solr_hit_spec.rb +1 -2
  76. data/spec/unit/solr_service_spec.rb +6 -0
  77. data/spec/unit/sparql_insert_spec.rb +1 -1
  78. data/spec/unit/with_metadata/metadata_node_spec.rb +26 -1
  79. metadata +28 -12
@@ -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"] },
@@ -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)
@@ -50,11 +50,25 @@ describe ActiveFedora::RDF::IndexingService do
50
50
  end
51
51
  end
52
52
 
53
- before do
54
- allow(MyObj).to receive(:index_config).and_return(index_config)
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) }
@@ -4,8 +4,7 @@ describe ActiveFedora::SolrHit do
4
4
  before(:all) do
5
5
  class AudioRecord < ActiveFedora::Base
6
6
  attr_accessor :id
7
- def self.connection_for_id(_id)
8
- end
7
+ def self.connection_for_id(_id); end
9
8
  end
10
9
  end
11
10
 
@@ -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')
@@ -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
@@ -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: 11.1.3
4
+ version: 11.2.1
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: 2017-02-09 00:00:00.000000000 Z
13
+ date: 2020-06-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsolr
@@ -126,14 +126,28 @@ dependencies:
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: 0.6.0
129
+ version: 0.7.0
130
130
  type: :runtime
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
- version: 0.6.0
136
+ version: 0.7.0
137
+ - !ruby/object:Gem::Dependency
138
+ name: ruby-progressbar
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '1.0'
144
+ type: :runtime
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '1.0'
137
151
  - !ruby/object:Gem::Dependency
138
152
  name: rails
139
153
  requirement: !ruby/object:Gem::Requirement
@@ -196,14 +210,14 @@ dependencies:
196
210
  requirements:
197
211
  - - "~>"
198
212
  - !ruby/object:Gem::Version
199
- version: '0.15'
213
+ version: '1.0'
200
214
  type: :development
201
215
  prerelease: false
202
216
  version_requirements: !ruby/object:Gem::Requirement
203
217
  requirements:
204
218
  - - "~>"
205
219
  - !ruby/object:Gem::Version
206
- version: '0.15'
220
+ version: '1.0'
207
221
  - !ruby/object:Gem::Dependency
208
222
  name: fcrepo_wrapper
209
223
  requirement: !ruby/object:Gem::Requirement
@@ -280,28 +294,28 @@ dependencies:
280
294
  requirements:
281
295
  - - "~>"
282
296
  - !ruby/object:Gem::Version
283
- version: 0.42.0
297
+ version: 0.47.1
284
298
  type: :development
285
299
  prerelease: false
286
300
  version_requirements: !ruby/object:Gem::Requirement
287
301
  requirements:
288
302
  - - "~>"
289
303
  - !ruby/object:Gem::Version
290
- version: 0.42.0
304
+ version: 0.47.1
291
305
  - !ruby/object:Gem::Dependency
292
306
  name: rubocop-rspec
293
307
  requirement: !ruby/object:Gem::Requirement
294
308
  requirements:
295
309
  - - "~>"
296
310
  - !ruby/object:Gem::Version
297
- version: 1.8.0
311
+ version: 1.12.0
298
312
  type: :development
299
313
  prerelease: false
300
314
  version_requirements: !ruby/object:Gem::Requirement
301
315
  requirements:
302
316
  - - "~>"
303
317
  - !ruby/object:Gem::Version
304
- version: 1.8.0
318
+ version: 1.12.0
305
319
  description: ActiveFedora provides for creating and managing objects in the Fedora
306
320
  Repository Architecture.
307
321
  email:
@@ -429,6 +443,7 @@ files:
429
443
  - lib/active_fedora/indexers/global_indexer.rb
430
444
  - lib/active_fedora/indexers/null_indexer.rb
431
445
  - lib/active_fedora/indexing.rb
446
+ - lib/active_fedora/indexing/descendant_fetcher.rb
432
447
  - lib/active_fedora/indexing/map.rb
433
448
  - lib/active_fedora/indexing_service.rb
434
449
  - lib/active_fedora/inheritable_accessors.rb
@@ -628,6 +643,8 @@ files:
628
643
  - spec/unit/has_and_belongs_to_many_association_spec.rb
629
644
  - spec/unit/has_many_association_spec.rb
630
645
  - spec/unit/indexers/global_indexer_spec.rb
646
+ - spec/unit/indexing/map/index_object_spec.rb
647
+ - spec/unit/indexing/map_spec.rb
631
648
  - spec/unit/indexing_service_spec.rb
632
649
  - spec/unit/indexing_spec.rb
633
650
  - spec/unit/inheritance_spec.rb
@@ -683,8 +700,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
683
700
  - !ruby/object:Gem::Version
684
701
  version: '0'
685
702
  requirements: []
686
- rubyforge_project:
687
- rubygems_version: 2.6.8
703
+ rubygems_version: 3.1.2
688
704
  signing_key:
689
705
  specification_version: 4
690
706
  summary: A convenience libary for manipulating documents in the Fedora Repository.