active-fedora 9.9.0 → 9.10.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 +20 -6
- data/.travis.yml +2 -6
- data/History.txt +146 -0
- data/active-fedora.gemspec +11 -8
- data/lib/active_fedora/associations/association.rb +44 -14
- data/lib/active_fedora/associations/association_scope.rb +6 -2
- data/lib/active_fedora/associations/basic_contains_association.rb +2 -3
- data/lib/active_fedora/associations/belongs_to_association.rb +23 -14
- data/lib/active_fedora/associations/builder/association.rb +95 -41
- data/lib/active_fedora/associations/builder/belongs_to.rb +30 -2
- data/lib/active_fedora/associations/builder/collection_association.rb +36 -4
- data/lib/active_fedora/associations/builder/contains.rb +10 -5
- data/lib/active_fedora/associations/builder/directly_contains.rb +6 -8
- data/lib/active_fedora/associations/builder/directly_contains_one.rb +27 -20
- data/lib/active_fedora/associations/builder/has_and_belongs_to_many.rb +7 -3
- data/lib/active_fedora/associations/builder/has_many.rb +8 -45
- data/lib/active_fedora/associations/builder/indirectly_contains.rb +6 -8
- data/lib/active_fedora/associations/builder/property.rb +6 -12
- data/lib/active_fedora/associations/builder/singular_association.rb +3 -5
- data/lib/active_fedora/associations/builder/singular_property.rb +5 -4
- data/lib/active_fedora/associations/collection_association.rb +22 -26
- data/lib/active_fedora/associations/collection_proxy.rb +1 -1
- data/lib/active_fedora/associations/contained_finder.rb +1 -2
- data/lib/active_fedora/associations/directly_contains_one_association.rb +2 -3
- data/lib/active_fedora/associations/has_and_belongs_to_many_association.rb +1 -1
- data/lib/active_fedora/associations/has_many_association.rb +24 -5
- data/lib/active_fedora/associations/rdf.rb +1 -20
- data/lib/active_fedora/associations.rb +1 -1
- data/lib/active_fedora/attached_files.rb +2 -2
- data/lib/active_fedora/attribute_assignment.rb +55 -0
- data/lib/active_fedora/attribute_methods/read.rb +29 -44
- data/lib/active_fedora/attribute_methods/write.rb +16 -19
- data/lib/active_fedora/attribute_methods.rb +149 -29
- data/lib/active_fedora/attributes.rb +6 -18
- data/lib/active_fedora/autosave_association.rb +8 -12
- data/lib/active_fedora/base.rb +2 -2
- data/lib/active_fedora/caching_connection.rb +1 -1
- data/lib/active_fedora/callbacks.rb +9 -9
- data/lib/active_fedora/common.rb +67 -0
- data/lib/active_fedora/core.rb +11 -23
- data/lib/active_fedora/default_model_mapper.rb +24 -0
- data/lib/active_fedora/errors.rb +42 -0
- data/lib/active_fedora/fedora.rb +1 -1
- data/lib/active_fedora/file/attributes.rb +9 -10
- data/lib/active_fedora/file.rb +19 -56
- data/lib/active_fedora/file_persistence.rb +27 -0
- data/lib/active_fedora/indexing.rb +15 -9
- data/lib/active_fedora/indexing_service.rb +4 -4
- data/lib/active_fedora/inheritance.rb +34 -0
- data/lib/active_fedora/ldp_resource.rb +1 -0
- data/lib/active_fedora/model.rb +18 -16
- data/lib/active_fedora/model_classifier.rb +77 -0
- data/lib/active_fedora/nested_attributes.rb +145 -18
- data/lib/active_fedora/persistence.rb +23 -5
- data/lib/active_fedora/predicates.rb +3 -0
- data/lib/active_fedora/qualified_dublin_core_datastream.rb +1 -1
- data/lib/active_fedora/query_result_builder.rb +12 -28
- data/lib/active_fedora/querying.rb +1 -1
- data/lib/active_fedora/rdf/datastream_indexing.rb +1 -1
- data/lib/active_fedora/reflection.rb +212 -80
- data/lib/active_fedora/relation/calculations.rb +1 -5
- data/lib/active_fedora/relation/finder_methods.rb +39 -26
- data/lib/active_fedora/relation.rb +17 -0
- data/lib/active_fedora/scoping/default.rb +117 -0
- data/lib/active_fedora/scoping/named.rb +152 -4
- data/lib/active_fedora/scoping.rb +85 -2
- data/lib/active_fedora/simple_datastream.rb +1 -1
- data/lib/active_fedora/solr_hit.rb +71 -0
- data/lib/active_fedora/solr_instance_loader.rb +12 -36
- data/lib/active_fedora/solr_query_builder.rb +20 -25
- data/lib/active_fedora/solr_service.rb +24 -13
- data/lib/active_fedora/type/boolean.rb +23 -0
- data/lib/active_fedora/type/value.rb +118 -0
- data/lib/active_fedora/type.rb +8 -0
- data/lib/active_fedora/validations.rb +14 -5
- data/lib/active_fedora/version.rb +1 -1
- data/lib/active_fedora/versionable.rb +8 -7
- data/lib/active_fedora/with_metadata/metadata_node.rb +2 -1
- data/lib/active_fedora.rb +35 -15
- data/lib/generators/active_fedora/config/fedora/fedora_generator.rb +4 -0
- data/lib/generators/active_fedora/config/fedora/templates/.fcrepo_wrapper +3 -0
- data/lib/generators/active_fedora/config/solr/solr_generator.rb +4 -0
- data/lib/generators/active_fedora/config/solr/templates/.solr_wrapper +5 -0
- data/lib/generators/active_fedora/config/solr/templates/solr/config/solrconfig.xml +15 -0
- data/solr/config/solrconfig.xml +15 -0
- data/spec/config_helper.rb +0 -5
- data/spec/integration/associations_spec.rb +5 -5
- data/spec/integration/attached_files_spec.rb +4 -4
- data/spec/integration/base_spec.rb +4 -4
- data/spec/integration/bug_spec.rb +0 -1
- data/spec/integration/collection_association_spec.rb +34 -3
- data/spec/integration/file_spec.rb +2 -2
- data/spec/integration/full_featured_model_spec.rb +4 -4
- data/spec/integration/has_and_belongs_to_many_associations_spec.rb +1 -1
- data/spec/integration/has_many_associations_spec.rb +30 -1
- data/spec/integration/indirect_container_spec.rb +1 -1
- data/spec/integration/nested_attribute_spec.rb +6 -0
- data/spec/integration/ntriples_datastream_spec.rb +4 -4
- data/spec/integration/om_datastream_spec.rb +7 -7
- data/spec/integration/persistence_spec.rb +1 -1
- data/spec/integration/relation_delegation_spec.rb +1 -1
- data/spec/integration/scoped_query_spec.rb +13 -13
- data/spec/integration/solr_hit_spec.rb +52 -0
- data/spec/samples/hydra-mods_article_datastream.rb +2 -2
- data/spec/spec_helper.rb +5 -9
- data/spec/unit/active_fedora_spec.rb +0 -26
- data/spec/unit/attributes_spec.rb +13 -7
- data/spec/unit/base_spec.rb +20 -0
- data/spec/unit/builder/has_and_belongs_to_many_spec.rb +2 -3
- data/spec/unit/callback_spec.rb +3 -8
- data/spec/unit/collection_proxy_spec.rb +1 -1
- data/spec/unit/default_model_mapper_spec.rb +39 -0
- data/spec/unit/file_spec.rb +21 -2
- data/spec/unit/finder_methods_spec.rb +30 -6
- data/spec/unit/has_and_belongs_to_many_association_spec.rb +4 -4
- data/spec/unit/has_many_association_spec.rb +25 -3
- data/spec/unit/indexing_spec.rb +17 -3
- data/spec/unit/model_classifier_spec.rb +49 -0
- data/spec/unit/model_spec.rb +0 -9
- data/spec/unit/ntriples_datastream_spec.rb +16 -16
- data/spec/unit/om_datastream_spec.rb +7 -7
- data/spec/unit/qualified_dublin_core_datastream_spec.rb +1 -1
- data/spec/unit/query_result_builder_spec.rb +4 -10
- data/spec/unit/query_spec.rb +28 -28
- data/spec/unit/rdf/indexing_service_spec.rb +16 -16
- data/spec/unit/reflection_spec.rb +2 -2
- data/spec/unit/scoping_spec.rb +67 -0
- data/spec/unit/simple_datastream_spec.rb +2 -2
- data/spec/unit/solr_config_options_spec.rb +29 -32
- data/spec/unit/solr_hit_spec.rb +58 -0
- data/spec/unit/solr_query_builder_spec.rb +9 -1
- data/spec/unit/solr_service_spec.rb +19 -3
- data/spec/unit/validations_spec.rb +1 -1
- metadata +82 -20
- data/spec/support/freeze_mocks.rb +0 -12
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe ActiveFedora::DefaultModelMapper do
|
|
4
|
+
let(:classifier) { double }
|
|
5
|
+
let(:classifier_instance) { double }
|
|
6
|
+
let(:solr_field) { 'solr_field' }
|
|
7
|
+
let(:predicate) { 'info:predicate' }
|
|
8
|
+
subject { described_class.new classifier_class: classifier, solr_field: solr_field, predicate: predicate }
|
|
9
|
+
|
|
10
|
+
describe '#classifier' do
|
|
11
|
+
context 'with a solr document' do
|
|
12
|
+
let(:solr_document) { { 'solr_field' => ['xyz'] } }
|
|
13
|
+
|
|
14
|
+
before do
|
|
15
|
+
expect(classifier).to receive(:new).with(['xyz']).and_return(classifier_instance)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'creates a classifier from the solr field data' do
|
|
19
|
+
expect(subject.classifier(solr_document)).to eq classifier_instance
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context 'with a resource' do
|
|
24
|
+
let(:graph) do
|
|
25
|
+
RDF::Graph.new << [:hello, predicate, 'xyz']
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
let(:resource) { double(graph: graph) }
|
|
29
|
+
|
|
30
|
+
before do
|
|
31
|
+
expect(classifier).to receive(:new).with(['xyz']).and_return(classifier_instance)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'creates a classifier from the resource model predicate' do
|
|
35
|
+
expect(subject.classifier(resource)).to eq classifier_instance
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
data/spec/unit/file_spec.rb
CHANGED
|
@@ -185,6 +185,25 @@ describe ActiveFedora::File do
|
|
|
185
185
|
end
|
|
186
186
|
end
|
|
187
187
|
|
|
188
|
+
describe "#mime_type" do
|
|
189
|
+
let(:parent) { ActiveFedora::Base.create }
|
|
190
|
+
before do
|
|
191
|
+
parent.add_file('banana', path: 'apple', mime_type: 'video/webm')
|
|
192
|
+
parent.save!
|
|
193
|
+
end
|
|
194
|
+
it "persists" do
|
|
195
|
+
expect(parent.reload.apple.mime_type).to eq "video/webm"
|
|
196
|
+
end
|
|
197
|
+
it "can be updated" do
|
|
198
|
+
parent.reload
|
|
199
|
+
parent.apple.mime_type = "text/awesome"
|
|
200
|
+
expect(parent.apple.mime_type).to eq "text/awesome"
|
|
201
|
+
parent.save
|
|
202
|
+
|
|
203
|
+
expect(parent.reload.apple.mime_type).to eq "text/awesome"
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
188
207
|
context "original_name" do
|
|
189
208
|
subject { file.original_name }
|
|
190
209
|
|
|
@@ -379,9 +398,9 @@ describe ActiveFedora::File do
|
|
|
379
398
|
subject.content = "foo"
|
|
380
399
|
subject.save
|
|
381
400
|
expect(subject).to receive(:b_save).once
|
|
382
|
-
expect(subject).
|
|
401
|
+
expect(subject).to receive(:a_save)
|
|
383
402
|
expect(subject).to receive(:b_update).once
|
|
384
|
-
expect(subject).
|
|
403
|
+
expect(subject).to receive(:a_update)
|
|
385
404
|
subject.save
|
|
386
405
|
}
|
|
387
406
|
end
|
|
@@ -46,17 +46,17 @@ describe ActiveFedora::FinderMethods do
|
|
|
46
46
|
|
|
47
47
|
context "when value is an id" do
|
|
48
48
|
let(:value) { 'one/two/three' }
|
|
49
|
-
it { is_expected.to eq "_query_:\"{!
|
|
49
|
+
it { is_expected.to eq "_query_:\"{!field f=library_id}one/two/three\"" }
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
context "when value is an array" do
|
|
53
53
|
let(:value) { ['one', 'four'] }
|
|
54
|
-
it { is_expected.to eq "_query_:\"{!
|
|
55
|
-
"_query_:\"{!
|
|
54
|
+
it { is_expected.to eq "_query_:\"{!field f=library_id}one\" AND " \
|
|
55
|
+
"_query_:\"{!field f=library_id}four\"" }
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
describe "#
|
|
59
|
+
describe "#search_in_batches" do
|
|
60
60
|
let(:docs) { double('docs', has_next?: false) }
|
|
61
61
|
let(:select_handler) { 'select' }
|
|
62
62
|
let(:connection) { double('conn') }
|
|
@@ -70,14 +70,38 @@ describe ActiveFedora::FinderMethods do
|
|
|
70
70
|
end
|
|
71
71
|
it "yields the docs" do
|
|
72
72
|
expect { |b|
|
|
73
|
-
finder.
|
|
73
|
+
finder.search_in_batches({ 'age_t' => '21' }, { other_opt: 'test' }, &b)
|
|
74
74
|
}.to yield_with_args(docs)
|
|
75
75
|
end
|
|
76
76
|
|
|
77
77
|
context "with custom select handler" do
|
|
78
78
|
let(:select_handler) { 'select_test' }
|
|
79
79
|
it "uses the custom select handler" do
|
|
80
|
-
finder.
|
|
80
|
+
finder.search_in_batches({ 'age_t' => '21' }, other_opt: 'test') do end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe '#search_by_id' do
|
|
86
|
+
context 'with a document in solr' do
|
|
87
|
+
let(:doc) { double('Document') }
|
|
88
|
+
|
|
89
|
+
before do
|
|
90
|
+
expect(finder).to receive(:search_with_conditions).with({ id: 'x' }, hash_including(rows: 1)).and_return([doc])
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it "returns the document" do
|
|
94
|
+
expect(finder.search_by_id('x')).to eq doc
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
context 'without a document in solr' do
|
|
99
|
+
before do
|
|
100
|
+
expect(finder).to receive(:search_with_conditions).with({ id: 'x' }, hash_including(rows: 1)).and_return([])
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "returns the document" do
|
|
104
|
+
expect { finder.search_by_id('x') }.to raise_error ActiveFedora::ObjectNotFoundError
|
|
81
105
|
end
|
|
82
106
|
end
|
|
83
107
|
end
|
|
@@ -23,7 +23,7 @@ describe ActiveFedora::Associations::HasAndBelongsToManyAssociation do
|
|
|
23
23
|
context "a one way relationship " do
|
|
24
24
|
describe "adding memeber" do
|
|
25
25
|
it "sets the relationship attribute" do
|
|
26
|
-
reflection =
|
|
26
|
+
reflection = ActiveFedora::Reflection.create(:has_and_belongs_to_many, :pages, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOfCollection }, Book)
|
|
27
27
|
allow(ActiveFedora::SolrService).to receive(:query).and_return([])
|
|
28
28
|
ac = described_class.new(subject, reflection)
|
|
29
29
|
expect(ac).to receive(:callback).twice
|
|
@@ -41,7 +41,7 @@ describe ActiveFedora::Associations::HasAndBelongsToManyAssociation do
|
|
|
41
41
|
|
|
42
42
|
describe "finding member" do
|
|
43
43
|
let(:ids) { (0..15).map(&:to_s) }
|
|
44
|
-
let(:reflection) {
|
|
44
|
+
let(:reflection) { ActiveFedora::Reflection.create(:has_and_belongs_to_many, :pages, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOfCollection }, Book) }
|
|
45
45
|
let(:association) { described_class.new(subject, reflection) }
|
|
46
46
|
it "calls ActiveFedora::Base.find" do
|
|
47
47
|
expect(subject).to receive(:[]).with('page_ids').and_return(ids)
|
|
@@ -59,8 +59,8 @@ describe ActiveFedora::Associations::HasAndBelongsToManyAssociation do
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
context "with an inverse reflection" do
|
|
62
|
-
let!(:inverse) {
|
|
63
|
-
let(:reflection) {
|
|
62
|
+
let!(:inverse) { ActiveFedora::Reflection.create(:has_and_belongs_to_many, :books, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOfCollection }, Page) }
|
|
63
|
+
let(:reflection) { ActiveFedora::Reflection.create(:has_and_belongs_to_many, :pages, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.hasCollectionMember, inverse_of: 'books' }, Book) }
|
|
64
64
|
let(:ac) { described_class.new(subject, reflection) }
|
|
65
65
|
let(:object) { Page.new }
|
|
66
66
|
|
|
@@ -22,7 +22,7 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
|
22
22
|
allow(ActiveFedora::SolrService).to receive(:query).and_return([])
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
let(:reflection) {
|
|
25
|
+
let(:reflection) { ActiveFedora::Reflection.create(:has_many, 'pages', nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf }, Book) }
|
|
26
26
|
let(:association) { described_class.new(book, reflection) }
|
|
27
27
|
|
|
28
28
|
it "sets the book_id attribute" do
|
|
@@ -38,7 +38,7 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
|
38
38
|
Page.has_many :books, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf, class_name: 'ActiveFedora::Base'
|
|
39
39
|
Page.has_and_belongs_to_many :contents, predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf, class_name: 'ActiveFedora::Base'
|
|
40
40
|
end
|
|
41
|
-
let(:book_reflection) {
|
|
41
|
+
let(:book_reflection) { ActiveFedora::Reflection.create(:has_many, 'pages', nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isPartOf }, Book) }
|
|
42
42
|
let(:association) { described_class.new(book, book_reflection) }
|
|
43
43
|
|
|
44
44
|
subject { association.send(:find_polymorphic_inverse, page) }
|
|
@@ -65,10 +65,32 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
let(:owner) { TimeSpan.new }
|
|
68
|
-
let(:reflection) { TimeSpan.
|
|
68
|
+
let(:reflection) { TimeSpan._reflect_on_association(:images) }
|
|
69
69
|
|
|
70
70
|
it "finds the predicate" do
|
|
71
71
|
expect { described_class.new(owner, reflection) }.not_to raise_error
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
|
+
|
|
75
|
+
describe "scope" do
|
|
76
|
+
before do
|
|
77
|
+
class Library < ActiveFedora::Base
|
|
78
|
+
has_many :images
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
class Image < ActiveFedora::Base
|
|
82
|
+
belongs_to :library, predicate: ::RDF::URI('http://example.com/library')
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
after do
|
|
87
|
+
Object.send(:remove_const, :Library)
|
|
88
|
+
Object.send(:remove_const, :Image)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
context "of an unsaved target" do
|
|
92
|
+
subject { Library.new.images.scope }
|
|
93
|
+
it { is_expected.to be_kind_of ActiveFedora::NullRelation }
|
|
94
|
+
end
|
|
95
|
+
end
|
|
74
96
|
end
|
data/spec/unit/indexing_spec.rb
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe ActiveFedora::Indexing do
|
|
4
|
+
describe '.indexer' do
|
|
5
|
+
let(:indexing_class) { Class.new }
|
|
6
|
+
let(:klass) { Class.new }
|
|
7
|
+
before do
|
|
8
|
+
klass.include described_class
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "is settable as a class attribute" do
|
|
12
|
+
expect(klass.indexer).to eq ActiveFedora::IndexingService
|
|
13
|
+
klass.indexer = indexing_class
|
|
14
|
+
expect(klass.indexer).to eq indexing_class
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
4
18
|
context "internal methods" do
|
|
5
19
|
before :all do
|
|
6
20
|
class SpecNode
|
|
@@ -52,13 +66,13 @@ describe ActiveFedora::Indexing do
|
|
|
52
66
|
expect(test_object).to receive(:modified_date).and_return(DateTime.parse("2012-03-07T03:12:02Z")).twice
|
|
53
67
|
allow(test_object).to receive(:id).and_return('changeme:123')
|
|
54
68
|
solr_doc = test_object.to_solr
|
|
55
|
-
expect(solr_doc[ActiveFedora
|
|
56
|
-
expect(solr_doc[ActiveFedora
|
|
69
|
+
expect(solr_doc[ActiveFedora.index_field_mapper.solr_name("system_create", :stored_sortable, type: :date)]).to eql("2012-03-04T03:12:02Z")
|
|
70
|
+
expect(solr_doc[ActiveFedora.index_field_mapper.solr_name("system_modified", :stored_sortable, type: :date)]).to eql("2012-03-07T03:12:02Z")
|
|
57
71
|
expect(solr_doc[:id]).to eql("changeme:123")
|
|
58
72
|
end
|
|
59
73
|
|
|
60
74
|
it "adds self.class as the :active_fedora_model" do
|
|
61
|
-
expect(subject[ActiveFedora
|
|
75
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("active_fedora_model", :stored_sortable)]).to eql "SpecNode"
|
|
62
76
|
end
|
|
63
77
|
|
|
64
78
|
context "with attached files" do
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe ActiveFedora::ModelClassifier do
|
|
4
|
+
module ParentClass
|
|
5
|
+
class SiblingClass
|
|
6
|
+
end
|
|
7
|
+
class OtherSiblingClass
|
|
8
|
+
end
|
|
9
|
+
class SubclassClass < SiblingClass
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
let(:class_names) { ["ParentClass::SiblingClass", "ParentClass::OtherSiblingClass", "ParentClass::SubclassClass", "ParentClass::NoSuchClass"] }
|
|
14
|
+
subject { described_class.new class_names }
|
|
15
|
+
|
|
16
|
+
describe ".class_from_string" do
|
|
17
|
+
it "returns class constants based on strings" do
|
|
18
|
+
expect(described_class.class_from_string("Om")).to eq Om
|
|
19
|
+
expect(described_class.class_from_string("ActiveFedora::RDF::IndexingService")).to eq ActiveFedora::RDF::IndexingService
|
|
20
|
+
expect(described_class.class_from_string("IndexingService", ActiveFedora::RDF)).to eq ActiveFedora::RDF::IndexingService
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "finds sibling classes" do
|
|
24
|
+
expect(described_class.class_from_string("SiblingClass", ParentClass::OtherSiblingClass)).to eq ParentClass::SiblingClass
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "raises a NameError if the class isn't found" do
|
|
28
|
+
expect {
|
|
29
|
+
described_class.class_from_string("FooClass", ParentClass::OtherSiblingClass)
|
|
30
|
+
}.to raise_error NameError, /uninitialized constant (Object::)?FooClass/
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe '#models' do
|
|
35
|
+
it 'converts class names to classes' do
|
|
36
|
+
expect(subject.models).to match_array [ParentClass::SiblingClass, ParentClass::OtherSiblingClass, ParentClass::SubclassClass]
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe '#best_model' do
|
|
41
|
+
it 'selects the most specific matching model' do
|
|
42
|
+
expect(subject.best_model(default: nil)).to eq ParentClass::SubclassClass
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'filters models to subclasses of the default' do
|
|
46
|
+
expect(subject.best_model(default: ActiveFedora::Base)).to eq ActiveFedora::Base
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
data/spec/unit/model_spec.rb
CHANGED
|
@@ -27,13 +27,4 @@ describe ActiveFedora::Model do
|
|
|
27
27
|
it { should eq 'search' }
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
|
-
|
|
31
|
-
describe ".from_class_uri" do
|
|
32
|
-
subject { described_class.from_class_uri(uri) }
|
|
33
|
-
context "a blank string" do
|
|
34
|
-
before { expect(ActiveFedora::Base.logger).to receive(:warn) }
|
|
35
|
-
let(:uri) { '' }
|
|
36
|
-
it { should be_nil }
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
30
|
end
|
|
@@ -216,25 +216,25 @@ EOF
|
|
|
216
216
|
describe ".to_solr()" do
|
|
217
217
|
subject { @obj.to_solr({}, name: 'solrRdf') }
|
|
218
218
|
it "returns the right fields" do
|
|
219
|
-
expect(subject.keys).to include(ActiveFedora
|
|
220
|
-
ActiveFedora
|
|
221
|
-
ActiveFedora
|
|
222
|
-
ActiveFedora
|
|
223
|
-
ActiveFedora
|
|
224
|
-
ActiveFedora
|
|
225
|
-
ActiveFedora
|
|
226
|
-
ActiveFedora
|
|
227
|
-
ActiveFedora
|
|
228
|
-
ActiveFedora
|
|
219
|
+
expect(subject.keys).to include(ActiveFedora.index_field_mapper.solr_name("solr_rdf__related_url", type: :string),
|
|
220
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", type: :string),
|
|
221
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", :sortable),
|
|
222
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", :facetable),
|
|
223
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__created", :sortable, type: :date),
|
|
224
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__created", :displayable),
|
|
225
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__title", type: :string),
|
|
226
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__title", :sortable),
|
|
227
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__based_near", type: :string),
|
|
228
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__based_near", :facetable))
|
|
229
229
|
end
|
|
230
230
|
|
|
231
231
|
it "returns the right values" do
|
|
232
|
-
expect(subject[ActiveFedora
|
|
233
|
-
expect(subject[ActiveFedora
|
|
234
|
-
expect(subject[ActiveFedora
|
|
235
|
-
expect(subject[ActiveFedora
|
|
236
|
-
expect(subject[ActiveFedora
|
|
237
|
-
expect(subject[ActiveFedora
|
|
232
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__related_url", type: :string)]).to eq ["http://example.org/blogtastic/"]
|
|
233
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__based_near", type: :string)]).to eq ["Tacoma, WA", "Renton, WA"]
|
|
234
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__based_near", :facetable)]).to eq ["Tacoma, WA", "Renton, WA"]
|
|
235
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", type: :string)]).to eq ["Bob's Blogtastic Publishing"]
|
|
236
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", :sortable)]).to eq "Bob's Blogtastic Publishing"
|
|
237
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", :facetable)]).to eq ["Bob's Blogtastic Publishing"]
|
|
238
238
|
end
|
|
239
239
|
end
|
|
240
240
|
end
|
|
@@ -257,16 +257,16 @@ describe ActiveFedora::OmDatastream do
|
|
|
257
257
|
end
|
|
258
258
|
|
|
259
259
|
describe '.has_solr_name?' do
|
|
260
|
-
let(:name0_role0) { ActiveFedora
|
|
261
|
-
let(:name1_role1) { ActiveFedora
|
|
260
|
+
let(:name0_role0) { ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_0_role_0_roleTerm", type: :string) }
|
|
261
|
+
let(:name1_role1) { ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_1_role_1_roleTerm", type: :string) }
|
|
262
262
|
let(:solr_doc) do
|
|
263
263
|
{ "id" => "mods_article1",
|
|
264
|
-
ActiveFedora
|
|
265
|
-
ActiveFedora
|
|
266
|
-
ActiveFedora
|
|
264
|
+
ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_role_roleTerm", type: :string) => ["creator", "submitter", "teacher"],
|
|
265
|
+
ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_0_role", type: :string) => "\r\ncreator\r\nsubmitter\r\n",
|
|
266
|
+
ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_1_role", type: :string) => "\r\n teacher \r\n",
|
|
267
267
|
name0_role0 => "creator",
|
|
268
|
-
ActiveFedora
|
|
269
|
-
ActiveFedora
|
|
268
|
+
ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_0_role_1_roleTerm", type: :string) => "submitter",
|
|
269
|
+
ActiveFedora.index_field_mapper.solr_name("desc_metadata__name_1_role_0_roleTerm", type: :string) => ["teacher"] }
|
|
270
270
|
end
|
|
271
271
|
|
|
272
272
|
it "returns true if the given key exists in the solr document passed in" do
|
|
@@ -94,7 +94,7 @@ describe ActiveFedora::QualifiedDublinCoreDatastream do
|
|
|
94
94
|
@test_ds = described_class.new
|
|
95
95
|
@test_ds.title = "War and Peace"
|
|
96
96
|
solr = @test_ds.to_solr
|
|
97
|
-
expect(solr[ActiveFedora
|
|
97
|
+
expect(solr[ActiveFedora.index_field_mapper.solr_name('title', type: :string)]).to eq "War and Peace"
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
100
|
|
|
@@ -3,20 +3,14 @@ require 'spec_helper'
|
|
|
3
3
|
describe ActiveFedora::QueryResultBuilder do
|
|
4
4
|
describe "reify solr results" do
|
|
5
5
|
before(:all) do
|
|
6
|
-
class AudioRecord
|
|
6
|
+
class AudioRecord < ActiveFedora::Base
|
|
7
7
|
attr_accessor :id
|
|
8
8
|
def self.connection_for_id(_id)
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
|
-
@sample_solr_hits = [{ "id" => "my:_ID1_", ActiveFedora
|
|
12
|
-
{ "id" => "my:_ID2_", ActiveFedora
|
|
13
|
-
{ "id" => "my:_ID3_", ActiveFedora
|
|
14
|
-
end
|
|
15
|
-
describe ".reify_solr_result" do
|
|
16
|
-
it "uses .find to instantiate objects" do
|
|
17
|
-
expect(AudioRecord).to receive(:find).with("my:_ID1_", cast: true)
|
|
18
|
-
described_class.reify_solr_result(@sample_solr_hits.first)
|
|
19
|
-
end
|
|
11
|
+
@sample_solr_hits = [{ "id" => "my:_ID1_", ActiveFedora.index_field_mapper.solr_name("has_model", :symbol) => ["AudioRecord"] },
|
|
12
|
+
{ "id" => "my:_ID2_", ActiveFedora.index_field_mapper.solr_name("has_model", :symbol) => ["AudioRecord"] },
|
|
13
|
+
{ "id" => "my:_ID3_", ActiveFedora.index_field_mapper.solr_name("has_model", :symbol) => ["AudioRecord"] }]
|
|
20
14
|
end
|
|
21
15
|
describe ".reify_solr_results" do
|
|
22
16
|
it "uses AudioRecord.find to instantiate objects" do
|
data/spec/unit/query_spec.rb
CHANGED
|
@@ -7,8 +7,8 @@ describe ActiveFedora::Base do
|
|
|
7
7
|
end
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
|
-
let(:sort_query) { ActiveFedora
|
|
11
|
-
let(:model_query) { "_query_:\"{!
|
|
10
|
+
let(:sort_query) { ActiveFedora.index_field_mapper.solr_name("system_create", :stored_sortable, type: :date) + ' asc' }
|
|
11
|
+
let(:model_query) { "_query_:\"{!field f=has_model_ssim}SpecModel::Basic\"" }
|
|
12
12
|
|
|
13
13
|
after(:all) do
|
|
14
14
|
Object.send(:remove_const, :SpecModel)
|
|
@@ -77,9 +77,9 @@ describe ActiveFedora::Base do
|
|
|
77
77
|
let(:relation) { ActiveFedora::Relation.new(SpecModel::Basic) }
|
|
78
78
|
let(:solr) { ActiveFedora::SolrService.instance.conn }
|
|
79
79
|
let(:expected_query) { "#{model_query} AND " \
|
|
80
|
-
"_query_:\"{!
|
|
81
|
-
"_query_:\"{!
|
|
82
|
-
"_query_:\"{!
|
|
80
|
+
"_query_:\"{!field f=foo}bar\" AND " \
|
|
81
|
+
"_query_:\"{!field f=baz}quix\" AND " \
|
|
82
|
+
"_query_:\"{!field f=baz}quack\"" }
|
|
83
83
|
let(:expected_params) { { params: { sort: [sort_query], fl: 'id', q: expected_query, qt: 'standard' } } }
|
|
84
84
|
let(:expected_sort_params) { { params: { sort: ["title_t desc"], fl: 'id', q: expected_query, qt: 'standard' } } }
|
|
85
85
|
let(:mock_docs) { [{ "id" => "changeme:30" }, { "id" => "changeme:22" }] }
|
|
@@ -136,9 +136,9 @@ describe ActiveFedora::Base do
|
|
|
136
136
|
describe "with conditions" do
|
|
137
137
|
let(:solr) { ActiveFedora::SolrService.instance.conn }
|
|
138
138
|
let(:expected_query) { "#{model_query} AND " \
|
|
139
|
-
"_query_:\"{!
|
|
140
|
-
"_query_:\"{!
|
|
141
|
-
"_query_:\"{!
|
|
139
|
+
"_query_:\"{!field f=foo}bar\" AND " \
|
|
140
|
+
"_query_:\"{!field f=baz}quix\" AND " \
|
|
141
|
+
"_query_:\"{!field f=baz}quack\"" }
|
|
142
142
|
let(:expected_params) { { params: { sort: [sort_query], fl: 'id', q: expected_query, qt: 'standard' } } }
|
|
143
143
|
let(:mock_docs) { [{ "id" => "changeme-30" }, { "id" => "changeme-22" }] }
|
|
144
144
|
|
|
@@ -153,13 +153,13 @@ describe ActiveFedora::Base do
|
|
|
153
153
|
end
|
|
154
154
|
end
|
|
155
155
|
|
|
156
|
-
describe '#
|
|
156
|
+
describe '#search_in_batches' do
|
|
157
157
|
describe "with conditions hash" do
|
|
158
158
|
let(:solr) { ActiveFedora::SolrService.instance.conn }
|
|
159
159
|
let(:expected_query) { "#{model_query} AND " \
|
|
160
|
-
"_query_:\"{!
|
|
161
|
-
"_query_:\"{!
|
|
162
|
-
"_query_:\"{!
|
|
160
|
+
"_query_:\"{!field f=foo}bar\" AND " \
|
|
161
|
+
"_query_:\"{!field f=baz}quix\" AND " \
|
|
162
|
+
"_query_:\"{!field f=baz}quack\"" }
|
|
163
163
|
let(:expected_params) { { params: { sort: [sort_query], fl: 'id', q: expected_query, qt: 'standard' } } }
|
|
164
164
|
let(:mock_docs) { double('docs') }
|
|
165
165
|
|
|
@@ -168,7 +168,7 @@ describe ActiveFedora::Base do
|
|
|
168
168
|
expect(solr).to receive(:paginate).with(1, 1002, 'select', expected_params).and_return('response' => { 'docs' => mock_docs })
|
|
169
169
|
yielded = double("yielded method")
|
|
170
170
|
expect(yielded).to receive(:run).with(mock_docs)
|
|
171
|
-
SpecModel::Basic.
|
|
171
|
+
SpecModel::Basic.search_in_batches({ foo: 'bar', baz: ['quix', 'quack'] }, batch_size: 1002, fl: 'id') { |group| yielded.run group }
|
|
172
172
|
end
|
|
173
173
|
end
|
|
174
174
|
end
|
|
@@ -177,22 +177,22 @@ describe ActiveFedora::Base do
|
|
|
177
177
|
let(:mock_result) { { 'response' => { 'numFound' => 7 } } }
|
|
178
178
|
|
|
179
179
|
it "returns a count" do
|
|
180
|
-
expect(ActiveFedora::SolrService).to receive(:
|
|
181
|
-
.with(model_query, rows: 0
|
|
180
|
+
expect(ActiveFedora::SolrService).to receive(:get)
|
|
181
|
+
.with(model_query, rows: 0)
|
|
182
182
|
.and_return(mock_result)
|
|
183
183
|
expect(SpecModel::Basic.count).to eq 7
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
it "allows conditions" do
|
|
187
|
-
expect(ActiveFedora::SolrService).to receive(:
|
|
188
|
-
.with("#{model_query} AND (foo:bar)", rows: 0
|
|
187
|
+
expect(ActiveFedora::SolrService).to receive(:get)
|
|
188
|
+
.with("#{model_query} AND (foo:bar)", rows: 0)
|
|
189
189
|
.and_return(mock_result)
|
|
190
190
|
expect(SpecModel::Basic.count(conditions: 'foo:bar')).to eq 7
|
|
191
191
|
end
|
|
192
192
|
|
|
193
193
|
it "counts without a class specified" do
|
|
194
|
-
expect(ActiveFedora::SolrService).to receive(:
|
|
195
|
-
.with("(foo:bar)", rows: 0
|
|
194
|
+
expect(ActiveFedora::SolrService).to receive(:get)
|
|
195
|
+
.with("(foo:bar)", rows: 0)
|
|
196
196
|
.and_return(mock_result)
|
|
197
197
|
expect(described_class.count(conditions: 'foo:bar')).to eq 7
|
|
198
198
|
end
|
|
@@ -240,10 +240,10 @@ describe ActiveFedora::Base do
|
|
|
240
240
|
end
|
|
241
241
|
end
|
|
242
242
|
|
|
243
|
-
describe '#
|
|
243
|
+
describe '#search_with_conditions' do
|
|
244
244
|
let(:mock_result) { double('Result') }
|
|
245
245
|
let(:klass) { SpecModel::Basic }
|
|
246
|
-
subject { klass.
|
|
246
|
+
subject { klass.search_with_conditions(conditions) }
|
|
247
247
|
|
|
248
248
|
before do
|
|
249
249
|
expect(ActiveFedora::SolrService).to receive(:query)
|
|
@@ -252,9 +252,9 @@ describe ActiveFedora::Base do
|
|
|
252
252
|
|
|
253
253
|
context "with a hash of conditions" do
|
|
254
254
|
let(:expected_query) { "#{model_query} AND " \
|
|
255
|
-
"_query_:\"{!
|
|
256
|
-
"_query_:\"{!
|
|
257
|
-
"_query_:\"{!
|
|
255
|
+
"_query_:\"{!field f=foo}bar\" AND " \
|
|
256
|
+
"_query_:\"{!field f=baz}quix\" AND " \
|
|
257
|
+
"_query_:\"{!field f=baz}quack\"" }
|
|
258
258
|
let(:conditions) { { foo: 'bar', baz: ['quix', 'quack'] } }
|
|
259
259
|
|
|
260
260
|
it "makes a query to solr and returns the results" do
|
|
@@ -264,9 +264,9 @@ describe ActiveFedora::Base do
|
|
|
264
264
|
|
|
265
265
|
context "with quotes in the params" do
|
|
266
266
|
let(:expected_query) { "#{model_query} AND " \
|
|
267
|
-
"_query_:\"{!
|
|
268
|
-
"_query_:\"{!
|
|
269
|
-
"_query_:\"{!
|
|
267
|
+
"_query_:\"{!field f=foo}9\\\" Nails\" AND " \
|
|
268
|
+
"_query_:\"{!field f=baz}7\\\" version\" AND " \
|
|
269
|
+
"_query_:\"{!field f=baz}quack\"" }
|
|
270
270
|
let(:conditions) { { foo: '9" Nails', baz: ['7" version', 'quack'] } }
|
|
271
271
|
|
|
272
272
|
it "escapes quotes" do
|
|
@@ -279,7 +279,7 @@ describe ActiveFedora::Base do
|
|
|
279
279
|
|
|
280
280
|
context "with a hash" do
|
|
281
281
|
let(:conditions) { { baz: 'quack' } }
|
|
282
|
-
let(:expected_query) { "_query_:\"{!
|
|
282
|
+
let(:expected_query) { "_query_:\"{!field f=baz}quack\"" }
|
|
283
283
|
it "doesn't use the class if it's called on AF:Base " do
|
|
284
284
|
expect(subject).to eq mock_result
|
|
285
285
|
end
|
|
@@ -47,25 +47,25 @@ describe ActiveFedora::RDF::IndexingService do
|
|
|
47
47
|
describe "#generate_solr_document" do
|
|
48
48
|
subject { indexer.generate_solr_document(lambda { |key| "solr_rdf__#{key}" }) }
|
|
49
49
|
it "returns the right fields" do
|
|
50
|
-
expect(subject.keys).to include(ActiveFedora
|
|
51
|
-
ActiveFedora
|
|
52
|
-
ActiveFedora
|
|
53
|
-
ActiveFedora
|
|
54
|
-
ActiveFedora
|
|
55
|
-
ActiveFedora
|
|
56
|
-
ActiveFedora
|
|
57
|
-
ActiveFedora
|
|
58
|
-
ActiveFedora
|
|
59
|
-
ActiveFedora
|
|
50
|
+
expect(subject.keys).to include(ActiveFedora.index_field_mapper.solr_name("solr_rdf__related_url", type: :string),
|
|
51
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", type: :string),
|
|
52
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", :sortable),
|
|
53
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", :facetable),
|
|
54
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__created", :sortable, type: :date),
|
|
55
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__created", :displayable),
|
|
56
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__title", type: :string),
|
|
57
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__title", :sortable),
|
|
58
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__based_near", type: :string),
|
|
59
|
+
ActiveFedora.index_field_mapper.solr_name("solr_rdf__based_near", :facetable))
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
it "returns the right values" do
|
|
63
|
-
expect(subject[ActiveFedora
|
|
64
|
-
expect(subject[ActiveFedora
|
|
65
|
-
expect(subject[ActiveFedora
|
|
66
|
-
expect(subject[ActiveFedora
|
|
67
|
-
expect(subject[ActiveFedora
|
|
68
|
-
expect(subject[ActiveFedora
|
|
63
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__related_url", type: :string)]).to eq ["http://example.org/blogtastic/"]
|
|
64
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__based_near", type: :string)]).to eq ["Tacoma, WA", "Renton, WA"]
|
|
65
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__based_near", :facetable)]).to eq ["Tacoma, WA", "Renton, WA"]
|
|
66
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", type: :string)]).to eq ["Bob's Blogtastic Publishing"]
|
|
67
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", :sortable)]).to eq "Bob's Blogtastic Publishing"
|
|
68
|
+
expect(subject[ActiveFedora.index_field_mapper.solr_name("solr_rdf__publisher", :facetable)]).to eq ["Bob's Blogtastic Publishing"]
|
|
69
69
|
end
|
|
70
70
|
end
|
|
71
71
|
|
|
@@ -5,7 +5,7 @@ describe ActiveFedora::Reflection::AssociationReflection do
|
|
|
5
5
|
let(:name) { 'dummy' }
|
|
6
6
|
let(:options) { { inverse_of: :default_permissions } }
|
|
7
7
|
let(:active_fedora) { double }
|
|
8
|
-
let(:instance) { described_class.new(macro, name, options, active_fedora) }
|
|
8
|
+
let(:instance) { described_class.new(macro, name, nil, options, active_fedora) }
|
|
9
9
|
subject { instance.send :derive_foreign_key }
|
|
10
10
|
|
|
11
11
|
context "when a has_many" do
|
|
@@ -30,7 +30,7 @@ describe ActiveFedora::Reflection::AssociationReflection do
|
|
|
30
30
|
let(:name) { 'dummy' }
|
|
31
31
|
let(:options) { { as: 'foothing' } }
|
|
32
32
|
let(:active_fedora) { double }
|
|
33
|
-
let(:instance) { described_class.new(macro, name, options, active_fedora) }
|
|
33
|
+
let(:instance) { described_class.new(macro, name, nil, options, active_fedora) }
|
|
34
34
|
subject { instance.send :automatic_inverse_of }
|
|
35
35
|
|
|
36
36
|
context "when a has_many" do
|