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.
- checksums.yaml +5 -5
- data/.rubocop.yml +3 -2
- data/.rubocop_todo.yml +73 -18
- data/.travis.yml +4 -4
- data/History.txt +6 -0
- data/README.md +1 -1
- data/active-fedora.gemspec +5 -4
- data/lib/active_fedora.rb +3 -3
- 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 +3 -1
- data/lib/active_fedora/associations/builder/association.rb +1 -2
- data/lib/active_fedora/associations/null_validator.rb +1 -2
- data/lib/active_fedora/attached_files.rb +4 -0
- data/lib/active_fedora/attributes/property_builder.rb +3 -3
- data/lib/active_fedora/containers/container.rb +1 -2
- data/lib/active_fedora/file.rb +2 -3
- data/lib/active_fedora/file_configurator.rb +2 -2
- data/lib/active_fedora/fixity_service.rb +36 -5
- data/lib/active_fedora/indexers/null_indexer.rb +1 -2
- data/lib/active_fedora/indexing.rb +34 -15
- data/lib/active_fedora/indexing/descendant_fetcher.rb +101 -0
- data/lib/active_fedora/indexing/map.rb +11 -3
- data/lib/active_fedora/indexing_service.rb +6 -1
- data/lib/active_fedora/inheritance.rb +1 -1
- data/lib/active_fedora/null_logger.rb +2 -4
- data/lib/active_fedora/persistence.rb +2 -2
- data/lib/active_fedora/property.rb +1 -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 +7 -5
- data/lib/active_fedora/rdf/indexing_service.rb +9 -7
- data/lib/active_fedora/relation/finder_methods.rb +2 -1
- data/lib/active_fedora/solr_service.rb +2 -1
- 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 +2 -0
- data/spec/integration/associations_spec.rb +8 -8
- data/spec/integration/attached_files_spec.rb +1 -2
- 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/generators/fedora_generator_spec.rb +1 -1
- data/spec/integration/generators/solr_generator_spec.rb +1 -1
- data/spec/integration/has_many_associations_spec.rb +4 -5
- data/spec/integration/indexing_spec.rb +21 -1
- data/spec/integration/indirect_container_spec.rb +2 -2
- data/spec/integration/solr_hit_spec.rb +1 -1
- data/spec/integration/versionable_spec.rb +2 -2
- data/spec/unit/attached_files_spec.rb +36 -8
- data/spec/unit/attributes_spec.rb +5 -13
- data/spec/unit/base_spec.rb +2 -2
- 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_spec.rb +3 -3
- data/spec/unit/default_model_mapper_spec.rb +1 -1
- data/spec/unit/file_path_builder_spec.rb +1 -1
- data/spec/unit/file_spec.rb +23 -25
- data/spec/unit/files_hash_spec.rb +1 -2
- data/spec/unit/filter_spec.rb +2 -2
- 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 +1 -2
- 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 +1 -1
- data/spec/unit/rdf/indexing_service_spec.rb +17 -3
- data/spec/unit/reflection_spec.rb +2 -2
- data/spec/unit/solr_hit_spec.rb +1 -2
- data/spec/unit/solr_service_spec.rb +6 -0
- data/spec/unit/sparql_insert_spec.rb +1 -1
- data/spec/unit/with_metadata/metadata_node_spec.rb +26 -1
- metadata +28 -12
@@ -16,8 +16,8 @@ describe "Direct containers" do
|
|
16
16
|
let(:reloaded) { FooHistory.find(o.id) }
|
17
17
|
|
18
18
|
context "with no files" do
|
19
|
-
let(:o) { FooHistory.new }
|
20
19
|
subject { o.files }
|
20
|
+
let(:o) { FooHistory.new }
|
21
21
|
|
22
22
|
it { is_expected.to be_empty }
|
23
23
|
it { is_expected.to eq [] }
|
@@ -124,8 +124,8 @@ describe "Direct containers" do
|
|
124
124
|
let(:reloaded) { FooHistory.find(o.id) }
|
125
125
|
|
126
126
|
context "with no files" do
|
127
|
-
let(:o) { FooHistory.new }
|
128
127
|
subject { o.files }
|
128
|
+
let(:o) { FooHistory.new }
|
129
129
|
|
130
130
|
it { is_expected.to be_empty }
|
131
131
|
it { is_expected.to eq [] }
|
@@ -17,8 +17,8 @@ describe "fedora_solr_sync_issues" do
|
|
17
17
|
Object.send(:remove_const, :ParentThing)
|
18
18
|
end
|
19
19
|
|
20
|
-
let(:parent) { ParentThing.create }
|
21
20
|
subject(:child) { ChildThing.create parent: parent }
|
21
|
+
let(:parent) { ParentThing.create }
|
22
22
|
|
23
23
|
before { Ldp::Resource::RdfSource.new(ActiveFedora.fedora.connection, child.uri).delete }
|
24
24
|
|
@@ -4,7 +4,7 @@ require 'generators/active_fedora/config/fedora/fedora_generator'
|
|
4
4
|
describe ActiveFedora::Config::FedoraGenerator do
|
5
5
|
describe "#fcrepo_wrapper_config" do
|
6
6
|
let(:generator) { described_class.new }
|
7
|
-
let(:files_to_test) {[
|
7
|
+
let(:files_to_test) { [
|
8
8
|
'config/fcrepo_wrapper_test.yml',
|
9
9
|
'.fcrepo_wrapper'
|
10
10
|
]}
|
@@ -4,7 +4,7 @@ require 'generators/active_fedora/config/solr/solr_generator'
|
|
4
4
|
describe ActiveFedora::Config::SolrGenerator do
|
5
5
|
describe "#solr_wrapper_config" do
|
6
6
|
let(:generator) { described_class.new }
|
7
|
-
let(:files_to_test) {[
|
7
|
+
let(:files_to_test) { [
|
8
8
|
'config/solr_wrapper_test.yml',
|
9
9
|
'.solr_wrapper'
|
10
10
|
]}
|
@@ -28,17 +28,17 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
context "when the owner is not saved, and potential targets (Books) exist" do
|
31
|
+
subject { library.books.count }
|
31
32
|
let!(:book) { Book.create }
|
32
33
|
let(:library) { Library.new }
|
33
|
-
subject { library.books.count }
|
34
34
|
# it excludes the books that aren't associated
|
35
35
|
it { is_expected.to eq 0 }
|
36
36
|
end
|
37
37
|
|
38
38
|
context "when the owner is saved with associations" do
|
39
|
+
subject { library.reload; library.books.count }
|
39
40
|
let(:book) { Book.create }
|
40
41
|
let!(:library) { Library.create(books: [book]) }
|
41
|
-
subject { library.reload; library.books.count }
|
42
42
|
# it excludes the books that are associated
|
43
43
|
it { is_expected.to eq 1 }
|
44
44
|
end
|
@@ -55,13 +55,13 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
context "loading the association prior to a save that affects the association" do
|
58
|
-
let(:library) { Library.new }
|
59
58
|
before do
|
60
59
|
Book.create
|
61
60
|
library.books
|
62
61
|
library.save
|
63
62
|
end
|
64
63
|
subject { library.books.size }
|
64
|
+
let(:library) { Library.new }
|
65
65
|
it { is_expected.to eq 0 }
|
66
66
|
end
|
67
67
|
end
|
@@ -396,8 +396,6 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
396
396
|
Object.send(:remove_const, :Library)
|
397
397
|
end
|
398
398
|
|
399
|
-
let(:library) { Library.create }
|
400
|
-
|
401
399
|
before do
|
402
400
|
library.books.create(title: ["Great Book"])
|
403
401
|
library.books.first.title = ["Better book"]
|
@@ -405,6 +403,7 @@ describe ActiveFedora::Associations::HasManyAssociation do
|
|
405
403
|
end
|
406
404
|
|
407
405
|
subject(:books) { library.books(true) }
|
406
|
+
let(:library) { Library.create }
|
408
407
|
|
409
408
|
it "saves the new title" do
|
410
409
|
expect(books.first.title).to eq ["Better book"]
|
@@ -43,13 +43,33 @@ describe ActiveFedora::Base do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
describe "when some of the descendants are prioritized models" do
|
47
|
+
around do |example|
|
48
|
+
class PriorityModel < ActiveFedora::Base
|
49
|
+
end
|
50
|
+
original_defaults = ActiveFedora::Indexing::DescendantFetcher.default_priority_models
|
51
|
+
ActiveFedora::Indexing::DescendantFetcher.default_priority_models = ["PriorityModel"]
|
52
|
+
|
53
|
+
example.run
|
54
|
+
|
55
|
+
ActiveFedora::Indexing::DescendantFetcher.default_priority_models = original_defaults
|
56
|
+
Object.send(:remove_const, :PriorityModel)
|
57
|
+
end
|
58
|
+
let(:ids) { ['foo', 'bar'] }
|
59
|
+
let!(:priority_models) { [PriorityModel.create, PriorityModel.create] }
|
60
|
+
|
61
|
+
it "puts prioritized model ids first" do
|
62
|
+
expect(described_class.descendant_uris(ActiveFedora.fedora.base_uri).slice(0..(priority_models.count - 1))).to contain_exactly(*priority_models.collect(&:uri).collect(&:to_s))
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
46
66
|
describe "reindex_everything" do
|
47
67
|
let(:ids) { ['foo', 'bar'] }
|
48
68
|
let(:solr) { ActiveFedora::SolrService.instance.conn }
|
49
69
|
before do
|
50
70
|
solr.delete_by_query('*:*', params: { 'softCommit' => true })
|
51
71
|
end
|
52
|
-
it "
|
72
|
+
it "adds object to solr" do
|
53
73
|
expect {
|
54
74
|
described_class.reindex_everything
|
55
75
|
}.to change { ActiveFedora::SolrService.query('id:foo').size }.from(0).to(1)
|
@@ -114,8 +114,8 @@ describe "Indirect containers" do
|
|
114
114
|
let(:reloaded) { FooHistory.find(o.id) }
|
115
115
|
|
116
116
|
context "with no related_objects" do
|
117
|
-
let(:o) { FooHistory.new }
|
118
117
|
subject { o.related_objects }
|
118
|
+
let(:o) { FooHistory.new }
|
119
119
|
|
120
120
|
it { is_expected.to be_empty }
|
121
121
|
it { is_expected.to eq [] }
|
@@ -263,8 +263,8 @@ describe "Indirect containers" do
|
|
263
263
|
let(:reloaded) { FooHistory.find(o.id) }
|
264
264
|
|
265
265
|
context "with no related_objects" do
|
266
|
-
let(:o) { FooHistory.new }
|
267
266
|
subject { o.related_objects }
|
267
|
+
let(:o) { FooHistory.new }
|
268
268
|
|
269
269
|
it { is_expected.to be_empty }
|
270
270
|
it { is_expected.to eq [] }
|
@@ -11,6 +11,7 @@ describe ActiveFedora::SolrHit do
|
|
11
11
|
Object.send(:remove_const, :Foo)
|
12
12
|
end
|
13
13
|
|
14
|
+
subject(:solr_hit) { described_class.new(doc) }
|
14
15
|
let(:another) { Foo.create }
|
15
16
|
|
16
17
|
let!(:obj) { Foo.create!(
|
@@ -19,7 +20,6 @@ describe ActiveFedora::SolrHit do
|
|
19
20
|
) }
|
20
21
|
|
21
22
|
let(:doc) { obj.to_solr }
|
22
|
-
subject(:solr_hit) { described_class.new(doc) }
|
23
23
|
|
24
24
|
describe "#reify" do
|
25
25
|
let(:solr_reified) { solr_hit.reify }
|
@@ -32,6 +32,8 @@ describe ActiveFedora::Versionable do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
describe 'sorting versions' do
|
35
|
+
subject(:graph) { ActiveFedora::VersionsGraph.new }
|
36
|
+
|
35
37
|
before do
|
36
38
|
allow(graph).to receive(:fedora_versions) { versions }
|
37
39
|
end
|
@@ -40,8 +42,6 @@ describe ActiveFedora::Versionable do
|
|
40
42
|
let(:version2) { instance_double(ActiveFedora::VersionsGraph::ResourceVersion, uri: 'http://localhost:8983/fedora/rest/test/84/61/63/98/84616398-f63a-4572-ba01-0689339e4fcb/fcr:versions/87a0a8c317f1e790373a67-c9ee-447d-b740-4faa882b1a1f', label: 'version2', created: '2015-04-02T19:54:45.96Z') }
|
41
43
|
let(:versions) { [version1, version2] }
|
42
44
|
|
43
|
-
subject(:graph) { ActiveFedora::VersionsGraph.new }
|
44
|
-
|
45
45
|
it 'sorts by DateTime' do
|
46
46
|
expect(graph.first).to eq version2
|
47
47
|
end
|
@@ -110,20 +110,25 @@ describe ActiveFedora::AttachedFiles do
|
|
110
110
|
end
|
111
111
|
|
112
112
|
describe "#accessor_name" do
|
113
|
-
|
114
|
-
|
113
|
+
subject { af_base.send(:accessor_name, value) }
|
114
|
+
context "with lowercase" do
|
115
|
+
let(:value) { 'abc' }
|
116
|
+
it { is_expected.to eq 'abc' }
|
115
117
|
end
|
116
118
|
|
117
|
-
|
118
|
-
|
119
|
+
context "with uppercase" do
|
120
|
+
let(:value) { 'ARCHIVAL_XML' }
|
121
|
+
it { is_expected.to eq 'ARCHIVAL_XML' }
|
119
122
|
end
|
120
123
|
|
121
|
-
|
122
|
-
|
124
|
+
context "with camelcase" do
|
125
|
+
let(:value) { 'descMetadata' }
|
126
|
+
it { is_expected.to eq 'descMetadata' }
|
123
127
|
end
|
124
128
|
|
125
|
-
|
126
|
-
|
129
|
+
context "with dashes" do
|
130
|
+
let(:value) { 'a-b' }
|
131
|
+
it { is_expected.to eq 'a_b' }
|
127
132
|
end
|
128
133
|
end
|
129
134
|
|
@@ -187,4 +192,27 @@ describe ActiveFedora::AttachedFiles do
|
|
187
192
|
expect(af_base.metadata_streams).to_not include(file_ds)
|
188
193
|
end
|
189
194
|
end
|
195
|
+
|
196
|
+
context "When the resource is using idiomatic basic containment" do
|
197
|
+
before do
|
198
|
+
class Sample1 < ActiveFedora::Base
|
199
|
+
is_a_container
|
200
|
+
end
|
201
|
+
end
|
202
|
+
after do
|
203
|
+
Object.send(:remove_const, :Sample1)
|
204
|
+
end
|
205
|
+
|
206
|
+
before do
|
207
|
+
child = obj.contains.build
|
208
|
+
child.content = "Stuff"
|
209
|
+
child.save!
|
210
|
+
end
|
211
|
+
let(:obj) { Sample1.create! }
|
212
|
+
let(:obj2) { Sample1.find(obj.id) }
|
213
|
+
|
214
|
+
it "doesn't conflate attached_file and contains" do
|
215
|
+
expect(obj2.attached_files.keys).to be_empty
|
216
|
+
end
|
217
|
+
end
|
190
218
|
end
|
@@ -15,8 +15,8 @@ describe ActiveFedora::Base do
|
|
15
15
|
Object.send(:remove_const, :BarHistory4)
|
16
16
|
end
|
17
17
|
|
18
|
-
let(:obj) { BarHistory4.new(title: ['test1']) }
|
19
18
|
subject(:history) { obj }
|
19
|
+
let(:obj) { BarHistory4.new(title: ['test1'], id: 'test:123') }
|
20
20
|
|
21
21
|
describe "#attribute_names" do
|
22
22
|
context "on an instance" do
|
@@ -34,15 +34,7 @@ describe ActiveFedora::Base do
|
|
34
34
|
|
35
35
|
describe "#inspect" do
|
36
36
|
it "shows the attributes" do
|
37
|
-
expect(history.inspect).to eq "#<BarHistory4 id:
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "with a id" do
|
41
|
-
before { allow(history).to receive(:id).and_return('test:123') }
|
42
|
-
|
43
|
-
it "shows a id" do
|
44
|
-
expect(history.inspect).to eq "#<BarHistory4 id: \"test:123\", title: [\"test1\"], abstract: nil>"
|
45
|
-
end
|
37
|
+
expect(history.inspect).to eq "#<BarHistory4 id: \"test:123\", title: [\"test1\"], abstract: nil>"
|
46
38
|
end
|
47
39
|
|
48
40
|
describe "with no attributes" do
|
@@ -60,8 +52,8 @@ describe ActiveFedora::Base do
|
|
60
52
|
history.library = library
|
61
53
|
end
|
62
54
|
|
63
|
-
let(:library) { BarHistory4.create }
|
64
55
|
subject(:history) { BarHistory2.new }
|
56
|
+
let(:library) { BarHistory4.create }
|
65
57
|
|
66
58
|
after do
|
67
59
|
Object.send(:remove_const, :BarHistory2)
|
@@ -98,7 +90,7 @@ describe ActiveFedora::Base do
|
|
98
90
|
history.resource[:abstract] = ['foo', 'bar']
|
99
91
|
end
|
100
92
|
it "raises an error if just returning the first value would cause data loss" do
|
101
|
-
expect { history[:abstract] }.to raise_error ActiveFedora::ConstraintError, "Expected \"abstract\" to have 0-1 statements, but there are 2"
|
93
|
+
expect { history[:abstract] }.to raise_error ActiveFedora::ConstraintError, "Expected \"abstract\" of test:123 to have 0-1 statements, but there are 2"
|
102
94
|
end
|
103
95
|
end
|
104
96
|
end
|
@@ -144,7 +136,7 @@ describe ActiveFedora::Base do
|
|
144
136
|
it "does not allow an enumerable to a unique attribute writer" do
|
145
137
|
expect { history.abstract = "Low" }.not_to raise_error
|
146
138
|
expect { history.abstract = ["Low"]
|
147
|
-
}.to raise_error ArgumentError, "You attempted to set the property `abstract' to an enumerable value. However, this property is declared as singular."
|
139
|
+
}.to raise_error ArgumentError, "You attempted to set the property `abstract' of test:123 to an enumerable value. However, this property is declared as singular."
|
148
140
|
expect { history.abstract = nil }.not_to raise_error
|
149
141
|
end
|
150
142
|
end
|
data/spec/unit/base_spec.rb
CHANGED
@@ -63,8 +63,8 @@ describe ActiveFedora::Base do
|
|
63
63
|
Object.send(:remove_const, :FooHistory)
|
64
64
|
end
|
65
65
|
|
66
|
-
let(:instance) { FooHistory.new(title: ['A label']) }
|
67
66
|
subject { instance.rdf_label }
|
67
|
+
let(:instance) { FooHistory.new(title: ['A label']) }
|
68
68
|
|
69
69
|
it { is_expected.to eq ['A label'] }
|
70
70
|
end
|
@@ -88,8 +88,8 @@ describe ActiveFedora::Base do
|
|
88
88
|
Object.send(:remove_const, :Creator)
|
89
89
|
end
|
90
90
|
|
91
|
-
let(:instance) { Creator.new(foaf_name: ['Carolyn'], job: ['Developer']) }
|
92
91
|
subject { instance.rdf_label }
|
92
|
+
let(:instance) { Creator.new(foaf_name: ['Carolyn'], job: ['Developer']) }
|
93
93
|
|
94
94
|
it { is_expected.to eq ['Developer'] }
|
95
95
|
end
|
data/spec/unit/callback_spec.rb
CHANGED
@@ -24,7 +24,7 @@ describe ActiveFedora::Base do
|
|
24
24
|
Object.send(:remove_const, :CallbackStub)
|
25
25
|
end
|
26
26
|
|
27
|
-
it "has after_initialize, before_save,after_save, before_create, after_create
|
27
|
+
it "has after_initialize, before_save, after_save, before_create, after_create" do
|
28
28
|
allow_any_instance_of(CallbackStub).to receive(:a_init)
|
29
29
|
allow_any_instance_of(CallbackStub).to receive :b_create
|
30
30
|
allow_any_instance_of(CallbackStub).to receive :a_create
|
@@ -34,7 +34,7 @@ describe ActiveFedora::Base do
|
|
34
34
|
@cb.save
|
35
35
|
end
|
36
36
|
|
37
|
-
it "has after_initialize, before_save,after_save, before_create, after_create, after_update, before_update, before_destroy" do
|
37
|
+
it "has after_initialize, before_save, after_save, before_create, after_create, after_update, before_update, before_destroy" do
|
38
38
|
allow_any_instance_of(CallbackStub).to receive(:a_init)
|
39
39
|
allow_any_instance_of(CallbackStub).to receive(:b_create)
|
40
40
|
allow_any_instance_of(CallbackStub).to receive(:a_create)
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ActiveFedora::ChangeSet do
|
4
|
-
|
5
|
-
subject { change_set }
|
4
|
+
subject(:change_set) { described_class.new(base, base.resource, base.changed_attributes.keys) }
|
6
5
|
|
7
6
|
context "with an unchanged object" do
|
8
7
|
let(:base) { ActiveFedora::Base.new }
|
@@ -14,11 +14,12 @@ describe ActiveFedora::Associations::CollectionProxy do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
describe "#spawn" do
|
17
|
+
subject { proxy.spawn }
|
18
|
+
|
17
19
|
let(:reflection) { ActiveFedora::Reflection.create(:has_many, :pages, nil, { predicate: ActiveFedora::RDF::Fcrepo::RelsExt.isMemberOfCollection }, Book) }
|
18
20
|
let(:association) { ActiveFedora::Associations::HasManyAssociation.new(Book.new, reflection) }
|
19
21
|
let(:proxy) { described_class.new(association) }
|
20
22
|
|
21
|
-
subject { proxy.spawn }
|
22
23
|
it { is_expected.to be_instance_of ActiveFedora::Relation }
|
23
24
|
end
|
24
25
|
end
|
data/spec/unit/core_spec.rb
CHANGED
@@ -11,8 +11,8 @@ describe ActiveFedora::Base do
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
let(:library) { Library.create }
|
15
14
|
subject(:book) { Book.new(library: library, title: "War and Peace", publisher: "Random House") }
|
15
|
+
let(:library) { Library.create }
|
16
16
|
|
17
17
|
after do
|
18
18
|
Object.send(:remove_const, :Book)
|
@@ -117,8 +117,8 @@ describe ActiveFedora::Base do
|
|
117
117
|
end
|
118
118
|
|
119
119
|
describe "id_to_uri" do
|
120
|
-
let(:id) { '123456w' }
|
121
120
|
subject(:uri) { described_class.id_to_uri(id) }
|
121
|
+
let(:id) { '123456w' }
|
122
122
|
|
123
123
|
context "with no custom proc is set" do
|
124
124
|
it { is_expected.to eq "#{ActiveFedora.fedora.base_uri}/123456w" }
|
@@ -157,8 +157,8 @@ describe ActiveFedora::Base do
|
|
157
157
|
end
|
158
158
|
|
159
159
|
describe "uri_to_id" do
|
160
|
-
let(:uri) { "#{ActiveFedora.fedora.base_uri}/foo/123456w" }
|
161
160
|
subject(:uri_id) { described_class.uri_to_id(uri) }
|
161
|
+
let(:uri) { "#{ActiveFedora.fedora.base_uri}/foo/123456w" }
|
162
162
|
|
163
163
|
context "with no custom proc is set" do
|
164
164
|
it { is_expected.to eq 'foo/123456w' }
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe ActiveFedora::DefaultModelMapper do
|
4
|
+
subject(:mapper) { described_class.new classifier_class: classifier, solr_field: solr_field, predicate: predicate }
|
4
5
|
let(:classifier) { class_double(ActiveFedora::ModelClassifier) }
|
5
6
|
let(:classifier_instance) { instance_double(ActiveFedora::ModelClassifier) }
|
6
7
|
let(:solr_field) { 'solr_field' }
|
7
8
|
let(:predicate) { 'info:predicate' }
|
8
|
-
subject(:mapper) { described_class.new classifier_class: classifier, solr_field: solr_field, predicate: predicate }
|
9
9
|
|
10
10
|
describe '#classifier' do
|
11
11
|
context 'with a solr document' do
|
@@ -2,8 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ActiveFedora::FilePathBuilder do
|
4
4
|
describe ".build" do
|
5
|
-
let(:parent) { ActiveFedora::Base.new(id: '1234') }
|
6
5
|
subject { described_class.build(parent, nil, 'FOO') }
|
6
|
+
let(:parent) { ActiveFedora::Base.new(id: '1234') }
|
7
7
|
|
8
8
|
it { is_expected.to eq 'FOO1' }
|
9
9
|
|