active-fedora 10.1.0 → 11.1.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/.gitignore +1 -0
- data/.rubocop.yml +6 -7
- data/.rubocop_todo.yml +55 -0
- data/.solr_wrapper +6 -0
- data/.travis.yml +6 -9
- data/Gemfile +1 -0
- data/History.txt +34 -0
- data/README.md +1 -3
- data/active-fedora.gemspec +7 -13
- data/lib/active_fedora/aggregation/list_source.rb +2 -0
- data/lib/active_fedora/associations/association_scope.rb +1 -1
- data/lib/active_fedora/associations/builder/aggregation.rb +1 -1
- data/lib/active_fedora/associations/builder/association.rb +1 -1
- data/lib/active_fedora/associations/builder/orders.rb +11 -3
- data/lib/active_fedora/associations/collection_association.rb +5 -5
- data/lib/active_fedora/associations/collection_proxy.rb +10 -10
- data/lib/active_fedora/associations/contained_finder.rb +2 -2
- data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +1 -1
- data/lib/active_fedora/associations/has_many_association.rb +2 -2
- data/lib/active_fedora/associations/has_subresource_association.rb +2 -2
- data/lib/active_fedora/associations/orders_association.rb +4 -0
- data/lib/active_fedora/associations/rdf.rb +2 -0
- data/lib/active_fedora/attribute_assignment.rb +0 -1
- data/lib/active_fedora/attribute_methods/dirty.rb +1 -1
- data/lib/active_fedora/attribute_methods.rb +1 -1
- data/lib/active_fedora/attributes.rb +1 -1
- data/lib/active_fedora/base.rb +4 -8
- data/lib/active_fedora/change_set.rb +6 -2
- data/lib/active_fedora/cleaner.rb +1 -1
- data/lib/active_fedora/containers/container.rb +1 -1
- data/lib/active_fedora/core.rb +33 -30
- data/lib/active_fedora/fedora.rb +6 -2
- data/lib/active_fedora/fedora_attributes.rb +1 -1
- data/lib/active_fedora/file/streaming.rb +1 -1
- data/lib/active_fedora/file.rb +2 -1
- data/lib/active_fedora/file_configurator.rb +3 -3
- data/lib/active_fedora/indexing.rb +1 -18
- data/lib/active_fedora/indexing_service.rb +0 -9
- data/lib/active_fedora/initializing_connection.rb +1 -1
- data/lib/active_fedora/loadable_from_json.rb +12 -1
- data/lib/active_fedora/model_classifier.rb +1 -1
- data/lib/active_fedora/nested_attributes.rb +2 -2
- data/lib/active_fedora/null_logger.rb +10 -0
- data/lib/active_fedora/orders/list_node.rb +2 -2
- data/lib/active_fedora/orders/ordered_list.rb +8 -4
- data/lib/active_fedora/orders/target_proxy.rb +4 -0
- data/lib/active_fedora/querying.rb +1 -1
- data/lib/active_fedora/railtie.rb +2 -2
- data/lib/active_fedora/rake_support.rb +1 -1
- data/lib/active_fedora/rdf/field_map_entry.rb +6 -0
- data/lib/active_fedora/rdf/persistence.rb +1 -0
- data/lib/active_fedora/rdf/value_caster.rb +15 -0
- data/lib/active_fedora/rdf.rb +1 -1
- data/lib/active_fedora/relation/delegation.rb +4 -0
- data/lib/active_fedora/relation/finder_methods.rb +3 -1
- data/lib/active_fedora/solr_hit.rb +1 -14
- data/lib/active_fedora/solr_query_builder.rb +17 -13
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/with_metadata/metadata_node.rb +2 -1
- data/lib/active_fedora.rb +1 -12
- data/lib/generators/active_fedora/config/solr/templates/solr/config/solrconfig.xml +11 -0
- data/lib/generators/active_fedora/config/solr/templates/solr_wrapper_test.yml +1 -1
- data/lib/generators/active_fedora/model/model_generator.rb +1 -1
- data/lib/generators/active_fedora/model/templates/model.rb.erb +4 -4
- data/lib/tasks/active_fedora_dev.rake +1 -1
- data/spec/config_helper.rb +1 -1
- data/spec/integration/associations_spec.rb +23 -24
- data/spec/integration/attached_files_spec.rb +19 -9
- data/spec/integration/attributes_spec.rb +12 -16
- data/spec/integration/autosave_association_spec.rb +6 -6
- data/spec/integration/base_spec.rb +8 -8
- data/spec/integration/basic_contains_association_spec.rb +1 -1
- data/spec/integration/clean_connection_spec.rb +1 -1
- data/spec/integration/collection_association_spec.rb +2 -5
- data/spec/integration/date_time_properties_spec.rb +1 -17
- data/spec/integration/direct_container_spec.rb +12 -12
- data/spec/integration/directly_contains_one_association_spec.rb +11 -13
- data/spec/integration/eradicate_spec.rb +1 -1
- data/spec/integration/fedora_solr_sync_spec.rb +2 -2
- data/spec/integration/file_fixity_spec.rb +6 -8
- data/spec/integration/file_spec.rb +37 -39
- data/spec/integration/generators/solr_generator_spec.rb +7 -10
- data/spec/integration/has_and_belongs_to_many_associations_spec.rb +7 -7
- data/spec/integration/has_many_associations_spec.rb +9 -11
- data/spec/integration/indexing_spec.rb +2 -2
- data/spec/integration/indirect_container_spec.rb +11 -12
- data/spec/integration/json_serialization_spec.rb +4 -4
- data/spec/integration/query_result_builder_spec.rb +9 -21
- data/spec/integration/rdf_nested_attributes_spec.rb +7 -7
- data/spec/integration/relation_delegation_spec.rb +8 -10
- data/spec/integration/relation_spec.rb +13 -16
- data/spec/integration/scoped_query_spec.rb +3 -3
- data/spec/integration/scoping_spec.rb +3 -3
- data/spec/integration/solr_hit_spec.rb +4 -15
- data/spec/integration/versionable_spec.rb +73 -327
- data/spec/integration/with_metadata_spec.rb +1 -1
- data/spec/spec_helper.rb +52 -10
- data/spec/unit/active_fedora_spec.rb +1 -1
- data/spec/unit/aggregation/list_source_spec.rb +37 -37
- data/spec/unit/aggregation/ordered_reader_spec.rb +4 -4
- data/spec/unit/association_hash_spec.rb +17 -31
- data/spec/unit/attached_files_spec.rb +35 -32
- data/spec/unit/attributes_spec.rb +25 -25
- data/spec/unit/base_active_model_spec.rb +8 -8
- data/spec/unit/base_cma_spec.rb +1 -1
- data/spec/unit/base_extra_spec.rb +7 -22
- data/spec/unit/base_spec.rb +21 -27
- 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 +5 -5
- data/spec/unit/checksum_spec.rb +2 -2
- data/spec/unit/code_configurator_spec.rb +1 -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 +68 -32
- data/spec/unit/default_model_mapper_spec.rb +6 -6
- data/spec/unit/fedora_spec.rb +3 -4
- data/spec/unit/file_configurator_spec.rb +96 -96
- data/spec/unit/file_path_builder_spec.rb +3 -3
- data/spec/unit/file_spec.rb +93 -61
- data/spec/unit/files_hash_spec.rb +9 -9
- data/spec/unit/filter_spec.rb +3 -3
- data/spec/unit/finder_methods_spec.rb +3 -3
- data/spec/unit/forbidden_attributes_protection_spec.rb +2 -2
- data/spec/unit/has_and_belongs_to_many_association_spec.rb +14 -15
- data/spec/unit/has_many_association_spec.rb +28 -13
- data/spec/unit/indexers/global_indexer_spec.rb +6 -6
- data/spec/unit/indexing_service_spec.rb +5 -5
- data/spec/unit/indexing_spec.rb +8 -8
- data/spec/unit/inheritance_spec.rb +11 -7
- data/spec/unit/loadable_from_json_spec.rb +4 -4
- data/spec/unit/logger_spec.rb +1 -1
- data/spec/unit/model_classifier_spec.rb +5 -5
- data/spec/unit/ordered_spec.rb +144 -147
- data/spec/unit/orders/list_node_spec.rb +22 -22
- data/spec/unit/orders/ordered_list_spec.rb +96 -96
- data/spec/unit/orders/reflection_spec.rb +4 -4
- data/spec/unit/pathing_spec.rb +4 -4
- data/spec/unit/persistence_spec.rb +28 -28
- data/spec/unit/property_spec.rb +2 -2
- data/spec/unit/query_spec.rb +12 -12
- data/spec/unit/rdf/indexing_service_spec.rb +29 -29
- data/spec/unit/readonly_spec.rb +5 -4
- data/spec/unit/reflection_spec.rb +3 -3
- data/spec/unit/rspec_matchers/belong_to_associated_active_fedora_object_matcher_spec.rb +9 -9
- data/spec/unit/rspec_matchers/have_many_associated_active_fedora_objects_matcher_spec.rb +9 -9
- data/spec/unit/rspec_matchers/have_predicate_matcher_spec.rb +9 -9
- data/spec/unit/schema_indexing_strategy_spec.rb +5 -5
- data/spec/unit/serializers_spec.rb +3 -4
- data/spec/unit/solr_config_options_spec.rb +13 -16
- data/spec/unit/solr_hit_spec.rb +9 -9
- data/spec/unit/solr_service_spec.rb +4 -10
- data/spec/unit/sparql_insert_spec.rb +2 -2
- data/spec/unit/validations_spec.rb +12 -12
- data/spec/unit/with_metadata/default_metadata_class_factory_spec.rb +3 -2
- data/spec/unit/with_metadata/metadata_node_spec.rb +3 -2
- metadata +30 -130
- data/lib/active_fedora/datastreams/nokogiri_datastreams.rb +0 -119
- data/lib/active_fedora/datastreams.rb +0 -6
- data/lib/active_fedora/nom_datastream.rb +0 -73
- data/lib/active_fedora/om_datastream.rb +0 -118
- data/lib/active_fedora/profile_indexing_service.rb +0 -11
- data/lib/active_fedora/qualified_dublin_core_datastream.rb +0 -158
- data/lib/active_fedora/rdf/datastream_indexing.rb +0 -49
- data/lib/active_fedora/rdf/ntriples_rdf_datastream.rb +0 -13
- data/lib/active_fedora/rdf/rdf_datastream.rb +0 -167
- data/lib/active_fedora/rdf/rdfxml_datastream.rb +0 -13
- data/lib/active_fedora/solr_instance_loader.rb +0 -47
- data/solr/config/_rest_managed.json +0 -3
- data/solr/config/admin-extra.html +0 -31
- data/solr/config/elevate.xml +0 -36
- data/solr/config/mapping-ISOLatin1Accent.txt +0 -246
- data/solr/config/protwords.txt +0 -21
- data/solr/config/schema.xml +0 -372
- data/solr/config/scripts.conf +0 -24
- data/solr/config/solrconfig.xml +0 -311
- data/solr/config/spellings.txt +0 -2
- data/solr/config/stopwords.txt +0 -58
- data/solr/config/stopwords_en.txt +0 -58
- data/solr/config/synonyms.txt +0 -31
- data/solr/config/xslt/example.xsl +0 -132
- data/solr/config/xslt/example_atom.xsl +0 -67
- data/solr/config/xslt/example_rss.xsl +0 -66
- data/solr/config/xslt/luke.xsl +0 -337
- data/spec/fixtures/damsObjectModel.xml +0 -38
- data/spec/fixtures/dublin_core_rdf_descMetadata.nt +0 -13
- data/spec/fixtures/mixed_rdf_descMetadata.nt +0 -7
- data/spec/fixtures/mods_articles/mods_article1.xml +0 -98
- data/spec/fixtures/solr_rdf_descMetadata.nt +0 -7
- data/spec/integration/complex_rdf_datastream_spec.rb +0 -228
- data/spec/integration/datastream_rdf_nested_attributes_spec.rb +0 -179
- data/spec/integration/ntriples_datastream_spec.rb +0 -203
- data/spec/integration/om_datastream_spec.rb +0 -78
- data/spec/integration/solr_instance_loader_spec.rb +0 -156
- data/spec/samples/hydra-mods_article_datastream.rb +0 -517
- data/spec/samples/models/mods_article.rb +0 -9
- data/spec/samples/oral_history_sample.xml +0 -38
- data/spec/samples/oral_history_xml.xml +0 -35
- data/spec/samples/samples.rb +0 -2
- data/spec/unit/nom_datastream_spec.rb +0 -60
- data/spec/unit/ntriples_datastream_spec.rb +0 -170
- data/spec/unit/om_datastream_spec.rb +0 -294
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +0 -119
- data/spec/unit/rdf_datastream_spec.rb +0 -84
- data/spec/unit/rdf_resource_datastream_spec.rb +0 -204
- data/spec/unit/rdfxml_datastream_spec.rb +0 -106
|
@@ -25,30 +25,28 @@ describe ActiveFedora::Base do
|
|
|
25
25
|
let!(:instance2) { TestClass.create!(foo: ['Alpha'], bar: ['Peanuts']) }
|
|
26
26
|
let!(:instance3) { TestClass.create!(foo: ['Sigma'], bar: ['Peanuts']) }
|
|
27
27
|
|
|
28
|
-
subject { TestClass.where(bar: 'Peanuts') }
|
|
28
|
+
subject(:peanuts) { TestClass.where(bar: 'Peanuts') }
|
|
29
29
|
|
|
30
30
|
it "maps" do
|
|
31
|
-
expect(
|
|
31
|
+
expect(peanuts.map(&:id)).to contain_exactly instance2.id, instance3.id
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it "collects" do
|
|
35
|
-
expect(
|
|
35
|
+
expect(peanuts.collect(&:id)).to contain_exactly instance2.id, instance3.id
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
it "has each" do
|
|
39
|
-
|
|
40
|
-
expect(t).to receive(:foo).twice
|
|
41
|
-
subject.each { t.foo }
|
|
39
|
+
expect(peanuts.each.to_a.length).to eq 2
|
|
42
40
|
end
|
|
43
41
|
|
|
44
42
|
it "has all?" do
|
|
45
|
-
expect(
|
|
46
|
-
expect(
|
|
43
|
+
expect(peanuts.all? { |t| t.foo == ['Alpha'] }).to be false
|
|
44
|
+
expect(peanuts.all? { |t| t.bar == ['Peanuts'] }).to be true
|
|
47
45
|
end
|
|
48
46
|
|
|
49
47
|
it "has include?" do
|
|
50
|
-
expect(
|
|
51
|
-
expect(
|
|
48
|
+
expect(peanuts.include?(instance1)).to be false
|
|
49
|
+
expect(peanuts.include?(instance2)).to be true
|
|
52
50
|
end
|
|
53
51
|
end
|
|
54
52
|
end
|
|
@@ -15,15 +15,13 @@ describe ActiveFedora::Base do
|
|
|
15
15
|
Object.send(:remove_const, :Book)
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
subject { Library.all }
|
|
18
|
+
subject(:libraries) { Library.all }
|
|
19
19
|
|
|
20
20
|
it "is a relation" do
|
|
21
|
-
expect(
|
|
21
|
+
expect(libraries.class).to be ActiveFedora::Relation
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
it
|
|
25
|
-
expect(subject).to respond_to(:each_with_index)
|
|
26
|
-
end
|
|
24
|
+
it { is_expected.to respond_to(:each_with_index) }
|
|
27
25
|
|
|
28
26
|
context "when some records exist" do
|
|
29
27
|
before do
|
|
@@ -34,43 +32,42 @@ describe ActiveFedora::Base do
|
|
|
34
32
|
|
|
35
33
|
describe "is cached" do
|
|
36
34
|
before do
|
|
37
|
-
|
|
35
|
+
libraries.to_a # trigger initial load
|
|
38
36
|
end
|
|
39
37
|
|
|
40
|
-
it
|
|
41
|
-
|
|
42
|
-
end
|
|
38
|
+
it { is_expected.to be_loaded }
|
|
39
|
+
|
|
43
40
|
it "does not reload" do
|
|
44
41
|
expect_any_instance_of(ActiveFedora::Relation).to_not receive :find_each
|
|
45
|
-
|
|
42
|
+
libraries[0]
|
|
46
43
|
end
|
|
47
44
|
end
|
|
48
45
|
|
|
49
46
|
describe "#find" do
|
|
50
47
|
it "finds one of them" do
|
|
51
|
-
expect(
|
|
48
|
+
expect(libraries.find(library1.id)).to eq library1
|
|
52
49
|
end
|
|
53
50
|
it "finds with a block" do
|
|
54
|
-
expect(
|
|
51
|
+
expect(libraries.find { |l| l.id == library1.id }).to eq library1
|
|
55
52
|
end
|
|
56
53
|
end
|
|
57
54
|
|
|
58
55
|
describe "#select" do
|
|
59
56
|
it "finds with a block" do
|
|
60
|
-
expect(
|
|
57
|
+
expect(libraries.select { |l| l.id == library1.id }).to eq [library1]
|
|
61
58
|
end
|
|
62
59
|
end
|
|
63
60
|
|
|
64
61
|
context "unpermitted methods" do
|
|
65
62
|
it "excludes them" do
|
|
66
|
-
expect {
|
|
63
|
+
expect { libraries.sort! }.to raise_error NoMethodError
|
|
67
64
|
end
|
|
68
65
|
end
|
|
69
66
|
|
|
70
67
|
context "when limit is applied" do
|
|
71
|
-
subject { Library.create books: [Book.create, Book.create] }
|
|
68
|
+
subject(:libraries) { Library.create books: [Book.create, Book.create] }
|
|
72
69
|
it "limits the number of books" do
|
|
73
|
-
expect(
|
|
70
|
+
expect(libraries.books.limit(1).size).to eq 1
|
|
74
71
|
end
|
|
75
72
|
end
|
|
76
73
|
end
|
|
@@ -68,13 +68,13 @@ describe ActiveFedora::Querying do
|
|
|
68
68
|
expect(ModelIntegrationSpec::Basic.where('foo' => ['Beta', 'Alpha'])).to eq [test_instance1, test_instance2]
|
|
69
69
|
end
|
|
70
70
|
it "orders" do
|
|
71
|
-
expect(ModelIntegrationSpec::Basic.order(ActiveFedora.index_field_mapper.solr_name('foo', :sortable) + ' asc')).to
|
|
71
|
+
expect(ModelIntegrationSpec::Basic.order(ActiveFedora.index_field_mapper.solr_name('foo', :sortable) + ' asc')).to contain_exactly test_instance2, test_instance1, test_instance3
|
|
72
72
|
end
|
|
73
73
|
it "limits" do
|
|
74
74
|
expect(ModelIntegrationSpec::Basic.limit(1)).to eq [test_instance1]
|
|
75
75
|
end
|
|
76
76
|
it "offsets" do
|
|
77
|
-
expect(ModelIntegrationSpec::Basic.offset(1)).to
|
|
77
|
+
expect(ModelIntegrationSpec::Basic.offset(1)).to contain_exactly test_instance2, test_instance3
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
it "chains queries" do
|
|
@@ -127,7 +127,7 @@ describe ActiveFedora::Querying do
|
|
|
127
127
|
end
|
|
128
128
|
it "logs an error" do
|
|
129
129
|
expect(ActiveFedora::Base.logger).to receive(:error).with("Although #{id} was found in Solr, it doesn't seem to exist in Fedora. The index is out of synch.")
|
|
130
|
-
expect(ModelIntegrationSpec::Basic.all).to
|
|
130
|
+
expect(ModelIntegrationSpec::Basic.all).to contain_exactly test_instance1, test_instance3
|
|
131
131
|
end
|
|
132
132
|
end
|
|
133
133
|
end
|
|
@@ -27,16 +27,16 @@ describe ActiveFedora::Scoping::Named do
|
|
|
27
27
|
describe '#find' do
|
|
28
28
|
describe "#find with a valid id without cast" do
|
|
29
29
|
subject { ActiveFedora::Base.find(test_instance.id) }
|
|
30
|
-
it {
|
|
30
|
+
it { is_expected.to be_instance_of TestClass }
|
|
31
31
|
end
|
|
32
32
|
describe "#find with a valid id with cast of false" do
|
|
33
33
|
subject { ActiveFedora::Base.find(test_instance.id, cast: false) }
|
|
34
|
-
it {
|
|
34
|
+
it { is_expected.to be_instance_of ActiveFedora::Base }
|
|
35
35
|
end
|
|
36
36
|
|
|
37
37
|
describe "#find with a valid id without cast on a model extending Base" do
|
|
38
38
|
subject { TestClass.find(test_instance.id) }
|
|
39
|
-
it {
|
|
39
|
+
it { is_expected.to be_instance_of TestClass }
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -19,25 +19,14 @@ describe ActiveFedora::SolrHit do
|
|
|
19
19
|
) }
|
|
20
20
|
|
|
21
21
|
let(:doc) { obj.to_solr }
|
|
22
|
-
|
|
22
|
+
subject(:solr_hit) { described_class.new(doc) }
|
|
23
23
|
|
|
24
24
|
describe "#reify" do
|
|
25
|
-
|
|
25
|
+
let(:solr_reified) { solr_hit.reify }
|
|
26
26
|
|
|
27
27
|
it "finds the document in solr" do
|
|
28
|
-
expect(
|
|
29
|
-
expect(
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe "#instantiate_with_json" do
|
|
34
|
-
subject { solr_hit.instantiate_with_json }
|
|
35
|
-
|
|
36
|
-
it { is_expected.to be_persisted }
|
|
37
|
-
|
|
38
|
-
it "finds the document in solr" do
|
|
39
|
-
expect(subject).to be_instance_of Foo
|
|
40
|
-
expect(subject.title).to eq 'My Title'
|
|
28
|
+
expect(solr_reified).to be_instance_of Foo
|
|
29
|
+
expect(solr_reified.title).to eq 'My Title'
|
|
41
30
|
end
|
|
42
31
|
end
|
|
43
32
|
end
|