hydra-pcdm 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +26 -0
- data/.travis.yml +14 -0
- data/CONTRIBUTING.md +115 -0
- data/Gemfile +13 -0
- data/LICENSE +12 -0
- data/README.md +87 -0
- data/Rakefile +20 -0
- data/config/jetty.yml +6 -0
- data/hydra-pcdm.gemspec +30 -0
- data/lib/hydra/pcdm/collection_indexer.rb +12 -0
- data/lib/hydra/pcdm/models/collection.rb +6 -0
- data/lib/hydra/pcdm/models/concerns/collection_behavior.rb +79 -0
- data/lib/hydra/pcdm/models/concerns/object_behavior.rb +104 -0
- data/lib/hydra/pcdm/models/file.rb +20 -0
- data/lib/hydra/pcdm/models/object.rb +6 -0
- data/lib/hydra/pcdm/object_indexer.rb +10 -0
- data/lib/hydra/pcdm/services/collection/add_collection.rb +20 -0
- data/lib/hydra/pcdm/services/collection/add_object.rb +19 -0
- data/lib/hydra/pcdm/services/collection/add_related_object.rb +21 -0
- data/lib/hydra/pcdm/services/collection/get_collections.rb +18 -0
- data/lib/hydra/pcdm/services/collection/get_objects.rb +18 -0
- data/lib/hydra/pcdm/services/collection/get_related_objects.rb +17 -0
- data/lib/hydra/pcdm/services/collection/remove_collection.rb +36 -0
- data/lib/hydra/pcdm/services/collection/remove_object.rb +43 -0
- data/lib/hydra/pcdm/services/collection/remove_related_object.rb +36 -0
- data/lib/hydra/pcdm/services/file/add_type.rb +20 -0
- data/lib/hydra/pcdm/services/file/get_mime_type.rb +11 -0
- data/lib/hydra/pcdm/services/object/add_object.rb +20 -0
- data/lib/hydra/pcdm/services/object/add_related_object.rb +21 -0
- data/lib/hydra/pcdm/services/object/get_objects.rb +18 -0
- data/lib/hydra/pcdm/services/object/get_related_objects.rb +17 -0
- data/lib/hydra/pcdm/services/object/remove_object.rb +43 -0
- data/lib/hydra/pcdm/services/object/remove_related_object.rb +36 -0
- data/lib/hydra/pcdm/version.rb +5 -0
- data/lib/hydra/pcdm/vocab/ebucore_terms.rb +33 -0
- data/lib/hydra/pcdm/vocab/pcdm_terms.rb +87 -0
- data/lib/hydra/pcdm/vocab/sweetjpl_terms.rb +10 -0
- data/lib/hydra/pcdm.rb +69 -0
- data/spec/hydra/pcdm/collection_indexer_spec.rb +26 -0
- data/spec/hydra/pcdm/models/collection_spec.rb +82 -0
- data/spec/hydra/pcdm/models/file_spec.rb +56 -0
- data/spec/hydra/pcdm/models/object_spec.rb +141 -0
- data/spec/hydra/pcdm/object_indexer_spec.rb +20 -0
- data/spec/hydra/pcdm/services/collection/add_collection_spec.rb +197 -0
- data/spec/hydra/pcdm/services/collection/add_object_spec.rb +132 -0
- data/spec/hydra/pcdm/services/collection/add_related_object_spec.rb +94 -0
- data/spec/hydra/pcdm/services/collection/get_collections_spec.rb +40 -0
- data/spec/hydra/pcdm/services/collection/get_objects_spec.rb +40 -0
- data/spec/hydra/pcdm/services/collection/get_related_objects_spec.rb +37 -0
- data/spec/hydra/pcdm/services/collection/remove_collection_spec.rb +143 -0
- data/spec/hydra/pcdm/services/collection/remove_object_spec.rb +180 -0
- data/spec/hydra/pcdm/services/collection/remove_related_object_spec.rb +146 -0
- data/spec/hydra/pcdm/services/file/add_type_spec.rb +19 -0
- data/spec/hydra/pcdm/services/file/get_mime_type_spec.rb +24 -0
- data/spec/hydra/pcdm/services/object/add_object_spec.rb +186 -0
- data/spec/hydra/pcdm/services/object/add_related_object_spec.rb +94 -0
- data/spec/hydra/pcdm/services/object/get_objects_spec.rb +33 -0
- data/spec/hydra/pcdm/services/object/get_related_objects_spec.rb +39 -0
- data/spec/hydra/pcdm/services/object/remove_object_spec.rb +158 -0
- data/spec/hydra/pcdm/services/object/remove_related_object_spec.rb +126 -0
- data/spec/hydra/pcdm_spec.rb +56 -0
- data/spec/spec_helper.rb +34 -0
- metadata +215 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hydra::PCDM::RemoveObjectFromObject do
|
4
|
+
|
5
|
+
subject { Hydra::PCDM::Object.create }
|
6
|
+
|
7
|
+
let(:object1) { Hydra::PCDM::Object.create }
|
8
|
+
let(:object2) { Hydra::PCDM::Object.create }
|
9
|
+
let(:object3) { Hydra::PCDM::Object.create }
|
10
|
+
let(:object4) { Hydra::PCDM::Object.create }
|
11
|
+
let(:object5) { Hydra::PCDM::Object.create }
|
12
|
+
|
13
|
+
describe '#call' do
|
14
|
+
context 'when it is the only object' do
|
15
|
+
before do
|
16
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object1 )
|
17
|
+
subject.save
|
18
|
+
expect( Hydra::PCDM::GetObjectsFromObject.call( subject.reload )).to eq [object1]
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should remove object' do
|
22
|
+
expect( Hydra::PCDM::RemoveObjectFromObject.call( subject, object1 ) ).to eq object1
|
23
|
+
expect( Hydra::PCDM::GetObjectsFromObject.call( subject.reload )).to eq []
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when multiple objects' do
|
28
|
+
before do
|
29
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object1 )
|
30
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object2 )
|
31
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object3 )
|
32
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object4 )
|
33
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object5 )
|
34
|
+
subject.save
|
35
|
+
expect( Hydra::PCDM::GetObjectsFromObject.call( subject.reload )).to eq [object1,object2,object3,object4,object5]
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should remove first object' do
|
39
|
+
expect( Hydra::PCDM::RemoveObjectFromObject.call( subject, object1 ) ).to eq object1
|
40
|
+
expect( Hydra::PCDM::GetObjectsFromObject.call( subject.reload )).to eq [object2,object3,object4,object5]
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should remove last object' do
|
44
|
+
expect( Hydra::PCDM::RemoveObjectFromObject.call( subject, object5 ) ).to eq object5
|
45
|
+
expect( Hydra::PCDM::GetObjectsFromObject.call( subject.reload )).to eq [object1,object2,object3,object4]
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should remove middle object' do
|
49
|
+
expect( Hydra::PCDM::RemoveObjectFromObject.call( subject, object3 ) ).to eq object3
|
50
|
+
expect( Hydra::PCDM::GetObjectsFromObject.call( subject.reload )).to eq [object1,object2,object4,object5]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'when object repeats' do
|
55
|
+
before do
|
56
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object1 )
|
57
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object2 )
|
58
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object3 )
|
59
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object2 )
|
60
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object4 )
|
61
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object2 )
|
62
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object5 )
|
63
|
+
subject.save
|
64
|
+
expect(Hydra::PCDM::GetObjectsFromObject.call( subject )).to eq [object1,object2,object3,object2,object4,object2,object5]
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should remove first occurrence' do
|
68
|
+
skip 'skipping this test because issue #102 needs to be addressed' do
|
69
|
+
expect( Hydra::PCDM::RemoveObjectFromObject.call( subject, object2 ) ).to eq object2
|
70
|
+
expect( Hydra::PCDM::GetObjectsFromObject.call( subject.reload )).to eq [object1,object3,object2,object4,object2,object5]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should remove last occurrence' do
|
75
|
+
skip 'skipping this test because issue #102 needs to be addressed' do
|
76
|
+
expect( Hydra::PCDM::RemoveObjectFromObject.call( subject, object2, -1 ) ).to eq object2
|
77
|
+
expect( Hydra::PCDM::GetObjectsFromObject.call( subject.reload )).to eq [object1,object2,object3,object2,object4,object5]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should remove nth occurrence' do
|
82
|
+
skip 'skipping this test because issue #102 needs to be addressed' do
|
83
|
+
expect( Hydra::PCDM::RemoveObjectFromObject.call( subject, object2, 2 ) ).to eq object2
|
84
|
+
expect( Hydra::PCDM::GetObjectsFromObject.call( subject.reload )).to eq [object1,object2,object3,object4,object2,object5]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'when object is missing' do
|
90
|
+
it 'should return nil' do
|
91
|
+
subject.save
|
92
|
+
expect( Hydra::PCDM::RemoveObjectFromObject.call( subject.reload, object1 )).to be nil
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should return nil' do
|
96
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object1 )
|
97
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object2 )
|
98
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object4 )
|
99
|
+
Hydra::PCDM::AddObjectToObject.call( subject, object5 )
|
100
|
+
subject.save
|
101
|
+
expect( Hydra::PCDM::RemoveObjectFromObject.call( subject.reload, object3 )).to be nil
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
context 'with unacceptable objects' do
|
107
|
+
let(:collection1) { Hydra::PCDM::Collection.create }
|
108
|
+
let(:file1) { Hydra::PCDM::File.new }
|
109
|
+
let(:non_PCDM_object) { "I'm not a PCDM object" }
|
110
|
+
let(:af_base_object) { ActiveFedora::Base.create }
|
111
|
+
|
112
|
+
let(:error_type) { ArgumentError }
|
113
|
+
let(:error_message) { 'child_object must be a pcdm object' }
|
114
|
+
|
115
|
+
it 'should NOT remove Hydra::PCDM::Collections from objects aggregation' do
|
116
|
+
expect{ Hydra::PCDM::RemoveObjectFromObject.call( subject, collection1 ) }.to raise_error(error_type,error_message)
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'should NOT remove Hydra::PCDM::Files from objects aggregation' do
|
120
|
+
expect{ Hydra::PCDM::RemoveObjectFromObject.call( subject, file1 ) }.to raise_error(error_type,error_message)
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'should NOT remove non-PCDM objects from objects aggregation' do
|
124
|
+
expect{ Hydra::PCDM::RemoveObjectFromObject.call( subject, non_PCDM_object ) }.to raise_error(error_type,error_message)
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'should NOT remove AF::Base objects from objects aggregation' do
|
128
|
+
expect{ Hydra::PCDM::RemoveObjectFromObject.call( subject, af_base_object ) }.to raise_error(error_type,error_message)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context 'with unacceptable parent object' do
|
133
|
+
let(:object2) { Hydra::PCDM::Object.create }
|
134
|
+
let(:collection1) { Hydra::PCDM::Collection.create }
|
135
|
+
let(:file1) { Hydra::PCDM::File.new }
|
136
|
+
let(:non_PCDM_object) { "I'm not a PCDM object" }
|
137
|
+
let(:af_base_object) { ActiveFedora::Base.create }
|
138
|
+
|
139
|
+
let(:error_type) { ArgumentError }
|
140
|
+
let(:error_message) { 'parent_object must be a pcdm object' }
|
141
|
+
|
142
|
+
it 'should NOT accept Hydra::PCDM::Collections as parent object' do
|
143
|
+
expect{ Hydra::PCDM::RemoveObjectFromObject.call( collection1, object2 ) }.to raise_error(error_type,error_message)
|
144
|
+
end
|
145
|
+
|
146
|
+
it 'should NOT accept Hydra::PCDM::Files as parent object' do
|
147
|
+
expect{ Hydra::PCDM::RemoveObjectFromObject.call( file1, object2 ) }.to raise_error(error_type,error_message)
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'should NOT accept non-PCDM objects as parent object' do
|
151
|
+
expect{ Hydra::PCDM::RemoveObjectFromObject.call( non_PCDM_object, object2 ) }.to raise_error(error_type,error_message)
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'should NOT accept AF::Base objects as parent object' do
|
155
|
+
expect{ Hydra::PCDM::RemoveObjectFromObject.call( af_base_object, object2 ) }.to raise_error(error_type,error_message)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hydra::PCDM::RemoveRelatedObjectFromObject do
|
4
|
+
|
5
|
+
subject { Hydra::PCDM::Object.create }
|
6
|
+
|
7
|
+
let(:object1) { Hydra::PCDM::Object.create }
|
8
|
+
let(:object2) { Hydra::PCDM::Object.create }
|
9
|
+
let(:object3) { Hydra::PCDM::Object.create }
|
10
|
+
let(:object4) { Hydra::PCDM::Object.create }
|
11
|
+
let(:object5) { Hydra::PCDM::Object.create }
|
12
|
+
|
13
|
+
let(:file1) { Hydra::PCDM::File.new }
|
14
|
+
let(:file2) { Hydra::PCDM::File.new }
|
15
|
+
|
16
|
+
describe '#call' do
|
17
|
+
context 'when it is the only related object' do
|
18
|
+
before do
|
19
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object1 )
|
20
|
+
subject.save
|
21
|
+
expect( Hydra::PCDM::GetRelatedObjectsFromObject.call( subject.reload )).to eq [object1]
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should remove related object' do
|
25
|
+
expect( Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject, object1 ) ).to eq object1
|
26
|
+
expect( Hydra::PCDM::GetRelatedObjectsFromObject.call( subject.reload )).to eq []
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when multiple related objects' do
|
31
|
+
before do
|
32
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object1 )
|
33
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object2 )
|
34
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object3 )
|
35
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object4 )
|
36
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object5 )
|
37
|
+
subject.save
|
38
|
+
expect( Hydra::PCDM::GetRelatedObjectsFromObject.call( subject.reload )).to eq [object1,object2,object3,object4,object5]
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should remove first related object' do
|
42
|
+
expect( Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject, object1 ) ).to eq object1
|
43
|
+
expect( Hydra::PCDM::GetRelatedObjectsFromObject.call( subject.reload )).to eq [object2,object3,object4,object5]
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should remove last related object' do
|
47
|
+
expect( Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject, object5 ) ).to eq object5
|
48
|
+
expect( Hydra::PCDM::GetRelatedObjectsFromObject.call( subject.reload )).to eq [object1,object2,object3,object4]
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should remove middle related object' do
|
52
|
+
expect( Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject, object3 ) ).to eq object3
|
53
|
+
expect( Hydra::PCDM::GetRelatedObjectsFromObject.call( subject.reload )).to eq [object1,object2,object4,object5]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when related object is missing' do
|
58
|
+
it 'should return nil when 0 related objects and 0 objects' do
|
59
|
+
subject.save
|
60
|
+
expect( Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject.reload, object1 )).to be nil
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should return nil when other related objects' do
|
64
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object1 )
|
65
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object2 )
|
66
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object4 )
|
67
|
+
Hydra::PCDM::AddRelatedObjectToObject.call( subject, object5 )
|
68
|
+
subject.save
|
69
|
+
expect( Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject.reload, object3 )).to be nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'with unacceptable related objects' do
|
75
|
+
let(:collection1) { Hydra::PCDM::Collection.create }
|
76
|
+
let(:file1) { Hydra::PCDM::File.new }
|
77
|
+
let(:non_PCDM_object) { "I'm not a PCDM object" }
|
78
|
+
let(:af_base_object) { ActiveFedora::Base.create }
|
79
|
+
|
80
|
+
let(:error_type) { ArgumentError }
|
81
|
+
let(:error_message) { 'child_related_object must be a pcdm object' }
|
82
|
+
|
83
|
+
it 'should NOT remove Hydra::PCDM::Collections from related_objects aggregation' do
|
84
|
+
expect{ Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject, collection1 ) }.to raise_error(error_type,error_message)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should NOT remove Hydra::PCDM::Files from related_objects aggregation' do
|
88
|
+
expect{ Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject, file1 ) }.to raise_error(error_type,error_message)
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'should NOT remove non-PCDM objects from related_objects aggregation' do
|
92
|
+
expect{ Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject, non_PCDM_object ) }.to raise_error(error_type,error_message)
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should NOT remove AF::Base objects from related_objects aggregation' do
|
96
|
+
expect{ Hydra::PCDM::RemoveRelatedObjectFromObject.call( subject, af_base_object ) }.to raise_error(error_type,error_message)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context 'with unacceptable parent object' do
|
101
|
+
let(:object2) { Hydra::PCDM::Object.create }
|
102
|
+
let(:collection1) { Hydra::PCDM::Collection.create }
|
103
|
+
let(:file1) { Hydra::PCDM::File.new }
|
104
|
+
let(:non_PCDM_object) { "I'm not a PCDM object" }
|
105
|
+
let(:af_base_object) { ActiveFedora::Base.create }
|
106
|
+
|
107
|
+
let(:error_type) { ArgumentError }
|
108
|
+
let(:error_message) { 'parent_object must be a pcdm object' }
|
109
|
+
|
110
|
+
it 'should NOT accept Hydra::PCDM::Objects as parent object' do
|
111
|
+
expect{ Hydra::PCDM::RemoveRelatedObjectFromObject.call( collection1, object2 ) }.to raise_error(error_type,error_message)
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'should NOT accept Hydra::PCDM::Files as parent object' do
|
115
|
+
expect{ Hydra::PCDM::RemoveRelatedObjectFromObject.call( file1, object2 ) }.to raise_error(error_type,error_message)
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'should NOT accept non-PCDM objects as parent object' do
|
119
|
+
expect{ Hydra::PCDM::RemoveRelatedObjectFromObject.call( non_PCDM_object, object2 ) }.to raise_error(error_type,error_message)
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should NOT accept AF::Base objects as parent object' do
|
123
|
+
expect{ Hydra::PCDM::RemoveRelatedObjectFromObject.call( af_base_object, object2 ) }.to raise_error(error_type,error_message)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hydra::PCDM do
|
4
|
+
|
5
|
+
let(:coll1) { Hydra::PCDM::Collection.create }
|
6
|
+
let(:obj1) { Hydra::PCDM::Object.create }
|
7
|
+
let(:file1) { Hydra::PCDM::File.new }
|
8
|
+
|
9
|
+
describe 'Validations' do
|
10
|
+
|
11
|
+
describe "#collection?" do
|
12
|
+
it "should return true for a pcdm collection" do
|
13
|
+
expect( Hydra::PCDM.collection? coll1 ).to be true
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return false for a pcdm object" do
|
17
|
+
expect( Hydra::PCDM.collection? obj1 ).to be false
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should return false for a pcdm file" do
|
21
|
+
expect( Hydra::PCDM.collection? file1 ).to be false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#object?" do
|
26
|
+
it "should return false for a pcdm collection" do
|
27
|
+
expect( Hydra::PCDM.object? coll1 ).to be false
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should return true for a pcdm object" do
|
31
|
+
expect( Hydra::PCDM.object? obj1 ).to be true
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should return false for a pcdm file" do
|
35
|
+
expect( Hydra::PCDM.object? file1 ).to be false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe "#file?" do
|
40
|
+
it "should return false for a pcdm collection" do
|
41
|
+
expect( Hydra::PCDM.file? coll1 ).to be false
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return false for a pcdm object" do
|
45
|
+
expect( Hydra::PCDM.file? obj1 ).to be false
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should return true for a pcdm file" do
|
49
|
+
expect( Hydra::PCDM.file? file1 ).to be true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
ENV['environment'] ||= 'test'
|
2
|
+
require 'coveralls'
|
3
|
+
Coveralls.wear!
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
Bundler.setup
|
7
|
+
|
8
|
+
require 'hydra/pcdm'
|
9
|
+
require 'pry' unless ENV['CI']
|
10
|
+
require 'active_fedora'
|
11
|
+
require 'active_fedora/cleaner'
|
12
|
+
|
13
|
+
Dir['./spec/support/**/*.rb'].each { |f| require f }
|
14
|
+
|
15
|
+
# require 'http_logger'
|
16
|
+
# HttpLogger.logger = Logger.new(STDOUT)
|
17
|
+
# HttpLogger.ignore = [/localhost:8983\/solr/]
|
18
|
+
# HttpLogger.colorize = false
|
19
|
+
# HttpLogger.log_headers = true
|
20
|
+
|
21
|
+
RSpec.configure do |config|
|
22
|
+
config.color = true
|
23
|
+
config.tty = true
|
24
|
+
|
25
|
+
# Uncomment the following line to get errors and backtrace for deprecation warnings
|
26
|
+
# config.raise_errors_for_deprecations!
|
27
|
+
|
28
|
+
# Use the specified formatter
|
29
|
+
config.formatter = :progress
|
30
|
+
|
31
|
+
config.before :suite do
|
32
|
+
ActiveFedora::Cleaner.clean!
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hydra-pcdm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- E. Lynette Rayle
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activefedora-aggregation
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jettywrapper
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Portland Common Data Model (PCDM)
|
98
|
+
email:
|
99
|
+
- elr37@cornell.edu
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".coveralls.yml"
|
105
|
+
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
107
|
+
- CONTRIBUTING.md
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- config/jetty.yml
|
113
|
+
- hydra-pcdm.gemspec
|
114
|
+
- lib/hydra/pcdm.rb
|
115
|
+
- lib/hydra/pcdm/collection_indexer.rb
|
116
|
+
- lib/hydra/pcdm/models/collection.rb
|
117
|
+
- lib/hydra/pcdm/models/concerns/collection_behavior.rb
|
118
|
+
- lib/hydra/pcdm/models/concerns/object_behavior.rb
|
119
|
+
- lib/hydra/pcdm/models/file.rb
|
120
|
+
- lib/hydra/pcdm/models/object.rb
|
121
|
+
- lib/hydra/pcdm/object_indexer.rb
|
122
|
+
- lib/hydra/pcdm/services/collection/add_collection.rb
|
123
|
+
- lib/hydra/pcdm/services/collection/add_object.rb
|
124
|
+
- lib/hydra/pcdm/services/collection/add_related_object.rb
|
125
|
+
- lib/hydra/pcdm/services/collection/get_collections.rb
|
126
|
+
- lib/hydra/pcdm/services/collection/get_objects.rb
|
127
|
+
- lib/hydra/pcdm/services/collection/get_related_objects.rb
|
128
|
+
- lib/hydra/pcdm/services/collection/remove_collection.rb
|
129
|
+
- lib/hydra/pcdm/services/collection/remove_object.rb
|
130
|
+
- lib/hydra/pcdm/services/collection/remove_related_object.rb
|
131
|
+
- lib/hydra/pcdm/services/file/add_type.rb
|
132
|
+
- lib/hydra/pcdm/services/file/get_mime_type.rb
|
133
|
+
- lib/hydra/pcdm/services/object/add_object.rb
|
134
|
+
- lib/hydra/pcdm/services/object/add_related_object.rb
|
135
|
+
- lib/hydra/pcdm/services/object/get_objects.rb
|
136
|
+
- lib/hydra/pcdm/services/object/get_related_objects.rb
|
137
|
+
- lib/hydra/pcdm/services/object/remove_object.rb
|
138
|
+
- lib/hydra/pcdm/services/object/remove_related_object.rb
|
139
|
+
- lib/hydra/pcdm/version.rb
|
140
|
+
- lib/hydra/pcdm/vocab/ebucore_terms.rb
|
141
|
+
- lib/hydra/pcdm/vocab/pcdm_terms.rb
|
142
|
+
- lib/hydra/pcdm/vocab/sweetjpl_terms.rb
|
143
|
+
- spec/hydra/pcdm/collection_indexer_spec.rb
|
144
|
+
- spec/hydra/pcdm/models/collection_spec.rb
|
145
|
+
- spec/hydra/pcdm/models/file_spec.rb
|
146
|
+
- spec/hydra/pcdm/models/object_spec.rb
|
147
|
+
- spec/hydra/pcdm/object_indexer_spec.rb
|
148
|
+
- spec/hydra/pcdm/services/collection/add_collection_spec.rb
|
149
|
+
- spec/hydra/pcdm/services/collection/add_object_spec.rb
|
150
|
+
- spec/hydra/pcdm/services/collection/add_related_object_spec.rb
|
151
|
+
- spec/hydra/pcdm/services/collection/get_collections_spec.rb
|
152
|
+
- spec/hydra/pcdm/services/collection/get_objects_spec.rb
|
153
|
+
- spec/hydra/pcdm/services/collection/get_related_objects_spec.rb
|
154
|
+
- spec/hydra/pcdm/services/collection/remove_collection_spec.rb
|
155
|
+
- spec/hydra/pcdm/services/collection/remove_object_spec.rb
|
156
|
+
- spec/hydra/pcdm/services/collection/remove_related_object_spec.rb
|
157
|
+
- spec/hydra/pcdm/services/file/add_type_spec.rb
|
158
|
+
- spec/hydra/pcdm/services/file/get_mime_type_spec.rb
|
159
|
+
- spec/hydra/pcdm/services/object/add_object_spec.rb
|
160
|
+
- spec/hydra/pcdm/services/object/add_related_object_spec.rb
|
161
|
+
- spec/hydra/pcdm/services/object/get_objects_spec.rb
|
162
|
+
- spec/hydra/pcdm/services/object/get_related_objects_spec.rb
|
163
|
+
- spec/hydra/pcdm/services/object/remove_object_spec.rb
|
164
|
+
- spec/hydra/pcdm/services/object/remove_related_object_spec.rb
|
165
|
+
- spec/hydra/pcdm_spec.rb
|
166
|
+
- spec/spec_helper.rb
|
167
|
+
homepage: https://github.com/projecthydra-labs/hydra-pcdm
|
168
|
+
licenses:
|
169
|
+
- APACHE2
|
170
|
+
metadata: {}
|
171
|
+
post_install_message:
|
172
|
+
rdoc_options: []
|
173
|
+
require_paths:
|
174
|
+
- lib
|
175
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 1.9.3
|
180
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '0'
|
185
|
+
requirements: []
|
186
|
+
rubyforge_project:
|
187
|
+
rubygems_version: 2.4.6
|
188
|
+
signing_key:
|
189
|
+
specification_version: 4
|
190
|
+
summary: Portland Common Data Model (PCDM)
|
191
|
+
test_files:
|
192
|
+
- spec/hydra/pcdm/collection_indexer_spec.rb
|
193
|
+
- spec/hydra/pcdm/models/collection_spec.rb
|
194
|
+
- spec/hydra/pcdm/models/file_spec.rb
|
195
|
+
- spec/hydra/pcdm/models/object_spec.rb
|
196
|
+
- spec/hydra/pcdm/object_indexer_spec.rb
|
197
|
+
- spec/hydra/pcdm/services/collection/add_collection_spec.rb
|
198
|
+
- spec/hydra/pcdm/services/collection/add_object_spec.rb
|
199
|
+
- spec/hydra/pcdm/services/collection/add_related_object_spec.rb
|
200
|
+
- spec/hydra/pcdm/services/collection/get_collections_spec.rb
|
201
|
+
- spec/hydra/pcdm/services/collection/get_objects_spec.rb
|
202
|
+
- spec/hydra/pcdm/services/collection/get_related_objects_spec.rb
|
203
|
+
- spec/hydra/pcdm/services/collection/remove_collection_spec.rb
|
204
|
+
- spec/hydra/pcdm/services/collection/remove_object_spec.rb
|
205
|
+
- spec/hydra/pcdm/services/collection/remove_related_object_spec.rb
|
206
|
+
- spec/hydra/pcdm/services/file/add_type_spec.rb
|
207
|
+
- spec/hydra/pcdm/services/file/get_mime_type_spec.rb
|
208
|
+
- spec/hydra/pcdm/services/object/add_object_spec.rb
|
209
|
+
- spec/hydra/pcdm/services/object/add_related_object_spec.rb
|
210
|
+
- spec/hydra/pcdm/services/object/get_objects_spec.rb
|
211
|
+
- spec/hydra/pcdm/services/object/get_related_objects_spec.rb
|
212
|
+
- spec/hydra/pcdm/services/object/remove_object_spec.rb
|
213
|
+
- spec/hydra/pcdm/services/object/remove_related_object_spec.rb
|
214
|
+
- spec/hydra/pcdm_spec.rb
|
215
|
+
- spec/spec_helper.rb
|