hydra-pbcore 0.0.2 → 0.0.3

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.
@@ -90,11 +90,9 @@ describe HydraPbcore::Datastream::Instantiation do
90
90
  @object_ds.update_indexed_attributes({ [:standard] => { 0 => "inserted" }} )
91
91
  @object_ds.update_indexed_attributes({ [:language] => { 0 => "inserted" }} )
92
92
 
93
- # insert optional nodes and set to sample values
94
- @object_ds.insert_node("next", {:root => "pbcoreInstantiation"})
95
- @object_ds.insert_node("previous", {:root => "pbcoreInstantiation"})
96
- @object_ds.update_indexed_attributes({ [:next] => { 0 => "inserted" }} )
97
- @object_ds.update_indexed_attributes({ [:previous] => { 0 => "inserted" }} )
93
+ # insert optional nodes using sample values
94
+ @object_ds.insert_next("inserted")
95
+ @object_ds.insert_previous("inserted")
98
96
 
99
97
  # Load example fixture
100
98
  f = fixture "pbcore_instantiation_template.xml"
@@ -131,4 +129,74 @@ describe HydraPbcore::Datastream::Instantiation do
131
129
 
132
130
  end
133
131
 
132
+ describe ".to_solr" do
133
+
134
+ before(:each) do
135
+ [
136
+ "name",
137
+ "location",
138
+ "date",
139
+ "generation",
140
+ "media_type",
141
+ "file_format",
142
+ "size",
143
+ "size_units",
144
+ "colors",
145
+ "duration",
146
+ "rights_summary",
147
+ "note",
148
+ "checksum_type",
149
+ "checksum_value",
150
+ "device",
151
+ "capture_soft",
152
+ "trans_soft",
153
+ "operator",
154
+ "trans_note",
155
+ "vendor",
156
+ "condition",
157
+ "cleaning",
158
+ "color_space",
159
+ "chroma",
160
+ "video_standard",
161
+ "video_encoding",
162
+ "video_bit_rate",
163
+ "video_bit_rate_units",
164
+ "frame_rate",
165
+ "frame_size",
166
+ "video_bit_depth",
167
+ "aspect_ratio",
168
+ "audio_standard",
169
+ "audio_encoding",
170
+ "audio_bit_rate",
171
+ "audio_bit_rate_units",
172
+ "audio_sample_rate",
173
+ "audio_sample_rate_units",
174
+ "audio_bit_depth",
175
+ "audio_channels"
176
+ ].each do |field|
177
+ @object_ds.send("#{field}=".to_sym, field)
178
+ end
179
+ end
180
+
181
+ it "should match an exmplar" do
182
+ # Load example fixture
183
+ f = fixture "pbcore_solr_instantiation_template.xml"
184
+ ref_node = Nokogiri::XML(f)
185
+ f.close
186
+
187
+ # Nokogiri-fy our sample document
188
+ sample_node = Nokogiri::XML(@object_ds.to_solr.to_xml)
189
+
190
+ # Save this for later...
191
+ out = File.new("tmp/pbcore_solr_instantation_sample.xml", "w")
192
+ out.write(sample_node.to_s)
193
+ out.close
194
+
195
+ EquivalentXml.equivalent?(ref_node, sample_node, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
196
+ end
197
+
198
+
199
+ end
200
+
201
+
134
202
  end
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hydra-pbcore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-18 00:00:00.000000000 Z
12
+ date: 2012-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -64,17 +64,17 @@ dependencies:
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - ! '>='
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: 2.0.0.rc3
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - ! '>='
75
+ - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: '0'
77
+ version: 2.0.0.rc3
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: yard
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -185,20 +185,27 @@ files:
185
185
  - README.md
186
186
  - Rakefile
187
187
  - hydra-pbcore.gemspec
188
+ - lib/custom_mapper.rb
188
189
  - lib/hydra-pbcore.rb
189
190
  - lib/hydra-pbcore/behaviors.rb
190
191
  - lib/hydra-pbcore/datastream/digital_document.rb
191
192
  - lib/hydra-pbcore/datastream/document.rb
192
193
  - lib/hydra-pbcore/datastream/instantiation.rb
193
194
  - lib/hydra-pbcore/methods.rb
195
+ - lib/hydra-pbcore/templates.rb
196
+ - lib/hydra-pbcore/version.rb
197
+ - spec/custom_mapper_spec.rb
194
198
  - spec/digital_document_spec.rb
195
199
  - spec/document_spec.rb
196
200
  - spec/fixtures/pbcore_digital_document_template.xml
197
201
  - spec/fixtures/pbcore_document_template.xml
198
202
  - spec/fixtures/pbcore_instantiation_template.xml
203
+ - spec/fixtures/pbcore_solr_digital_document_template.xml
204
+ - spec/fixtures/pbcore_solr_document_template.xml
205
+ - spec/fixtures/pbcore_solr_instantiation_template.xml
199
206
  - spec/instantiation_spec.rb
200
- - spec/methods_spec.rb
201
207
  - spec/spec_helper.rb
208
+ - spec/templates_spec.rb
202
209
  homepage: ''
203
210
  licenses: []
204
211
  post_install_message:
@@ -224,12 +231,16 @@ signing_key:
224
231
  specification_version: 3
225
232
  summary: A Hydra gem that offers PBCore datastream definitions using OM
226
233
  test_files:
234
+ - spec/custom_mapper_spec.rb
227
235
  - spec/digital_document_spec.rb
228
236
  - spec/document_spec.rb
229
237
  - spec/fixtures/pbcore_digital_document_template.xml
230
238
  - spec/fixtures/pbcore_document_template.xml
231
239
  - spec/fixtures/pbcore_instantiation_template.xml
240
+ - spec/fixtures/pbcore_solr_digital_document_template.xml
241
+ - spec/fixtures/pbcore_solr_document_template.xml
242
+ - spec/fixtures/pbcore_solr_instantiation_template.xml
232
243
  - spec/instantiation_spec.rb
233
- - spec/methods_spec.rb
234
244
  - spec/spec_helper.rb
245
+ - spec/templates_spec.rb
235
246
  has_rdoc:
data/spec/methods_spec.rb DELETED
@@ -1,63 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe HydraPbcore::Methods do
4
-
5
- before(:all) do
6
- class MethodTest < ActiveFedora::NokogiriDatastream
7
- include HydraPbcore::Methods
8
- end
9
- end
10
-
11
- describe "#contributor_template" do
12
- it "should insert a contributor xml template" do
13
- xml = '
14
- <pbcoreContributor>
15
- <contributor/>
16
- <contributorRole source="MARC relator terms"/>
17
- </pbcoreContributor>
18
- '
19
- node = MethodTest.contributor_template
20
- EquivalentXml.equivalent?(xml, node.to_xml, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
21
- end
22
- end
23
-
24
- describe "#publisher_template" do
25
- it "should insert a publisher xml template" do
26
- xml = '
27
- <pbcorePublisher>
28
- <publisher/>
29
- <publisherRole source="PBCore publisherRole"/>
30
- </pbcorePublisher>
31
- '
32
- node = MethodTest.publisher_template
33
- EquivalentXml.equivalent?(xml, node.to_xml, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
34
- end
35
- end
36
-
37
- describe "#previous_template" do
38
- it "should insert a instantiation relationship xml template" do
39
- xml = '
40
- <instantiationRelation>
41
- <instantiationRelationType annotation="One of a multi-part instantiation">Follows in Sequence</instantiationRelationType>
42
- <instantiationRelationIdentifier source="Rock and Roll Hall of Fame and Museum"/>
43
- </instantiationRelation>
44
- '
45
- node = MethodTest.previous_template
46
- EquivalentXml.equivalent?(xml, node.to_xml, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
47
- end
48
- end
49
-
50
- describe "#next_template" do
51
- it "should insert a instantiation relationship xml template" do
52
- xml = '
53
- <instantiationRelation>
54
- <instantiationRelationType annotation="One of a multi-part instantiation">Precedes in Sequence</instantiationRelationType>
55
- <instantiationRelationIdentifier source="Rock and Roll Hall of Fame and Museum"/>
56
- </instantiationRelation>
57
- '
58
- node = MethodTest.next_template
59
- EquivalentXml.equivalent?(xml, node.to_xml, opts = { :element_order => false, :normalize_whitespace => true }).should be_true
60
- end
61
- end
62
-
63
- end