rif-cs 1.0.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.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +33 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +9 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/lib/rif-cs.rb +167 -0
- data/lib/rif-cs/activity.rb +45 -0
- data/lib/rif-cs/collection.rb +74 -0
- data/lib/rif-cs/party.rb +45 -0
- data/lib/rif-cs/service.rb +40 -0
- data/rif-cs.gemspec +75 -0
- data/spec/files/activity.xml +59 -0
- data/spec/files/collection.xml +73 -0
- data/spec/files/party.xml +61 -0
- data/spec/files/service.xml +63 -0
- data/spec/rif-cs_activity_spec.rb +217 -0
- data/spec/rif-cs_collection_spec.rb +270 -0
- data/spec/rif-cs_party_spec.rb +228 -0
- data/spec/rif-cs_service_spec.rb +223 -0
- data/spec/rif-cs_spec.rb +388 -0
- data/spec/spec_helper.rb +12 -0
- metadata +129 -0
@@ -0,0 +1,223 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
describe "RIFCS::Service" do
|
3
|
+
|
4
|
+
class ServiceExample
|
5
|
+
include RIFCS::Service
|
6
|
+
|
7
|
+
attr_reader :service_key, :service_group
|
8
|
+
|
9
|
+
def initialize(key, group='Intersect Australia')
|
10
|
+
@service_key = key || 'service key'
|
11
|
+
@service_group = group
|
12
|
+
end
|
13
|
+
|
14
|
+
def service_originating_source
|
15
|
+
'http://www.intersect.org.au'
|
16
|
+
end
|
17
|
+
|
18
|
+
def service_root
|
19
|
+
{
|
20
|
+
date_modified: Time.new(2012, 6, 14).utc,
|
21
|
+
type: 'create'
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
def service_identifiers
|
26
|
+
[
|
27
|
+
{
|
28
|
+
type: 'local',
|
29
|
+
value: 'hdl:1959.4/004_311'
|
30
|
+
}
|
31
|
+
]
|
32
|
+
end
|
33
|
+
|
34
|
+
def service_names
|
35
|
+
[
|
36
|
+
{
|
37
|
+
:date_from => Time.new(2012, 6, 14),
|
38
|
+
:date_to => Time.new(2013, 6, 14),
|
39
|
+
:type => 'create',
|
40
|
+
:name_parts => [
|
41
|
+
{
|
42
|
+
:type => nil,
|
43
|
+
:value => 'Autolab PGSTAT 12 Potentiostat'
|
44
|
+
}
|
45
|
+
]
|
46
|
+
}
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
def service_locations
|
51
|
+
[
|
52
|
+
{
|
53
|
+
addresses: [
|
54
|
+
{
|
55
|
+
electronic: [
|
56
|
+
{
|
57
|
+
type: 'email',
|
58
|
+
value: 'joe@example.com'
|
59
|
+
},
|
60
|
+
],
|
61
|
+
physical: [
|
62
|
+
{
|
63
|
+
type: 'postalAddress',
|
64
|
+
address_parts: [
|
65
|
+
{
|
66
|
+
type: 'country',
|
67
|
+
value: 'Austrlia'
|
68
|
+
},
|
69
|
+
]
|
70
|
+
},
|
71
|
+
{
|
72
|
+
address_parts: [
|
73
|
+
{
|
74
|
+
type: 'telephoneNumber',
|
75
|
+
value: '+61 2 9123 4567'
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
79
|
+
]
|
80
|
+
}
|
81
|
+
],
|
82
|
+
spatials: [
|
83
|
+
{
|
84
|
+
value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
|
85
|
+
type: 'gml'
|
86
|
+
}
|
87
|
+
]
|
88
|
+
}
|
89
|
+
]
|
90
|
+
end
|
91
|
+
|
92
|
+
def service_coverage
|
93
|
+
[
|
94
|
+
{
|
95
|
+
spatials: [
|
96
|
+
{
|
97
|
+
value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
|
98
|
+
type: 'gml'
|
99
|
+
}
|
100
|
+
],
|
101
|
+
temporals: [
|
102
|
+
{
|
103
|
+
dates: [
|
104
|
+
{
|
105
|
+
value: Time.new(2012,6,14).utc,
|
106
|
+
date_format: 'UTC',
|
107
|
+
type: 'dateFrom'
|
108
|
+
},
|
109
|
+
{
|
110
|
+
value: Time.new(2013,6,14).utc,
|
111
|
+
date_format: 'UTC',
|
112
|
+
type: 'dateTo'
|
113
|
+
},
|
114
|
+
],
|
115
|
+
text: ['Self destructs in 1 year']
|
116
|
+
}
|
117
|
+
]
|
118
|
+
}
|
119
|
+
]
|
120
|
+
end
|
121
|
+
|
122
|
+
def service_related_objects
|
123
|
+
{
|
124
|
+
has_association_with: [
|
125
|
+
{
|
126
|
+
key: 'http://nla.gov.au/nla.party-593921',
|
127
|
+
}
|
128
|
+
],
|
129
|
+
is_presented_by: [
|
130
|
+
{
|
131
|
+
key: 'some group'
|
132
|
+
}
|
133
|
+
]
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
def service_subjects
|
138
|
+
[
|
139
|
+
]
|
140
|
+
end
|
141
|
+
|
142
|
+
def service_descriptions
|
143
|
+
[
|
144
|
+
{
|
145
|
+
type: 'deliverymethod',
|
146
|
+
value: 'offline'
|
147
|
+
},
|
148
|
+
{
|
149
|
+
type: 'full',
|
150
|
+
value: 'General-purpose potentiostat.'
|
151
|
+
}
|
152
|
+
]
|
153
|
+
end
|
154
|
+
|
155
|
+
def service_access_policies
|
156
|
+
[
|
157
|
+
{ value: 'http://example.com/policy' }
|
158
|
+
]
|
159
|
+
end
|
160
|
+
|
161
|
+
def service_rights
|
162
|
+
[
|
163
|
+
{
|
164
|
+
rights_statement: {
|
165
|
+
rights_uri: 'http://www.intersect.org.au/policies',
|
166
|
+
value: 'Copyright 2012 Intersect Australia Ltd.'
|
167
|
+
},
|
168
|
+
licence: {
|
169
|
+
value: 'Attribution (CC BY)',
|
170
|
+
rights_uri: 'http://creativecommons.org/licenses/by/3.0',
|
171
|
+
type: ''
|
172
|
+
},
|
173
|
+
access_rights: {
|
174
|
+
value: 'Available to all without restriction'
|
175
|
+
}
|
176
|
+
}
|
177
|
+
]
|
178
|
+
end
|
179
|
+
|
180
|
+
def service_existence_dates
|
181
|
+
[
|
182
|
+
{
|
183
|
+
start_date: {
|
184
|
+
value: Time.new(2012, 6, 14).utc,
|
185
|
+
date_format: 'UTC'
|
186
|
+
},
|
187
|
+
end_date: {
|
188
|
+
}
|
189
|
+
}
|
190
|
+
]
|
191
|
+
end
|
192
|
+
|
193
|
+
def service_related_info
|
194
|
+
[
|
195
|
+
{
|
196
|
+
type: 'website',
|
197
|
+
identifier: {
|
198
|
+
value: 'http://example.com/personalsites/foo',
|
199
|
+
type: 'uri'
|
200
|
+
},
|
201
|
+
title: 'This person\'s blog',
|
202
|
+
notes: 'Another blog'
|
203
|
+
},
|
204
|
+
{
|
205
|
+
type: 'publication',
|
206
|
+
identifier: {
|
207
|
+
value: '111',
|
208
|
+
type: 'isbn'
|
209
|
+
},
|
210
|
+
title: 'The Ordering of Things',
|
211
|
+
notes: 'Not available'
|
212
|
+
}
|
213
|
+
]
|
214
|
+
end
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should give a RIF-CS XML Service record for a model" do
|
219
|
+
expected = IO.read(File.join(File.dirname(__FILE__), 'files', 'service.xml'))
|
220
|
+
service = ServiceExample.new(nil)
|
221
|
+
service.to_rifcs.to_xml.should eq(expected)
|
222
|
+
end
|
223
|
+
end
|
data/spec/rif-cs_spec.rb
ADDED
@@ -0,0 +1,388 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "RIFCS" do
|
4
|
+
|
5
|
+
let (:address) {
|
6
|
+
{
|
7
|
+
electronic: [
|
8
|
+
{
|
9
|
+
type: 'email',
|
10
|
+
value: 'joe@example.com'
|
11
|
+
}
|
12
|
+
],
|
13
|
+
physical: [
|
14
|
+
{
|
15
|
+
type: 'postalAddress',
|
16
|
+
address_parts: [ { type: 'country', value: 'Austrlia' } ]
|
17
|
+
}
|
18
|
+
]
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
let (:spatial) {
|
23
|
+
{
|
24
|
+
value: '<gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint>',
|
25
|
+
type: 'gml'
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
before :each do
|
30
|
+
@xml = Nokogiri::XML::Builder.new
|
31
|
+
end
|
32
|
+
|
33
|
+
it "creates XML from a simple list" do
|
34
|
+
test_things = [
|
35
|
+
{ :value => '1st', :attr => 'some attribute' },
|
36
|
+
{ :value => '2nd', :attr => 'some other attribute' }
|
37
|
+
]
|
38
|
+
@xml.root do |xml|
|
39
|
+
RIFCS::list_of(test_things, 'things', xml)
|
40
|
+
end
|
41
|
+
@xml.to_xml.should == <<EOX
|
42
|
+
<?xml version="1.0"?>
|
43
|
+
<root>
|
44
|
+
<things attr="some attribute">1st</things>
|
45
|
+
<things attr="some other attribute">2nd</things>
|
46
|
+
</root>
|
47
|
+
EOX
|
48
|
+
end
|
49
|
+
|
50
|
+
it "creates the names element" do
|
51
|
+
names = [
|
52
|
+
{
|
53
|
+
type: 'primary',
|
54
|
+
date_from: Time.new(2012, 1, 1).utc,
|
55
|
+
date_to: Time.new(2012, 1, 1).utc,
|
56
|
+
xmllang: 'optional',
|
57
|
+
name_parts: [ { type: 'given', value: 'Test' } ]
|
58
|
+
}
|
59
|
+
]
|
60
|
+
@xml.root do |xml|
|
61
|
+
RIFCS::names(names, xml)
|
62
|
+
end
|
63
|
+
@xml.to_xml.should == <<EOX
|
64
|
+
<?xml version="1.0"?>
|
65
|
+
<root>
|
66
|
+
<name dateFrom="2011-12-31 13:00:00 UTC" dateTo="2011-12-31 13:00:00 UTC" type="primary" xml:lang="optional">
|
67
|
+
<namePart type="given">Test</namePart>
|
68
|
+
</name>
|
69
|
+
</root>
|
70
|
+
EOX
|
71
|
+
end
|
72
|
+
|
73
|
+
it "creates the locations element" do
|
74
|
+
locations = [
|
75
|
+
{
|
76
|
+
date_from: Time.new(2012, 6, 14).utc,
|
77
|
+
addresses: [ address ]
|
78
|
+
}
|
79
|
+
]
|
80
|
+
@xml.root do |xml|
|
81
|
+
RIFCS::locations(locations, xml)
|
82
|
+
end
|
83
|
+
@xml.to_xml.should == <<EOX
|
84
|
+
<?xml version="1.0"?>
|
85
|
+
<root>
|
86
|
+
<location dateFrom="2012-06-13 14:00:00 UTC" dateTo="" type="">
|
87
|
+
<address>
|
88
|
+
<electronic type="email">
|
89
|
+
<value>joe@example.com</value>
|
90
|
+
</electronic>
|
91
|
+
<physical type="postalAddress" xml:lang="">
|
92
|
+
<addressPart type="country">Austrlia</addressPart>
|
93
|
+
</physical>
|
94
|
+
</address>
|
95
|
+
</location>
|
96
|
+
</root>
|
97
|
+
EOX
|
98
|
+
end
|
99
|
+
|
100
|
+
it "creates spatial elements" do
|
101
|
+
@xml.root do |xml|
|
102
|
+
RIFCS::spatials([ spatial ], xml)
|
103
|
+
end
|
104
|
+
@xml.to_xml.should == <<EOX
|
105
|
+
<?xml version="1.0"?>
|
106
|
+
<root>
|
107
|
+
<spatial type="gml" xml:lang=""><gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint></spatial>
|
108
|
+
</root>
|
109
|
+
EOX
|
110
|
+
end
|
111
|
+
|
112
|
+
describe "creates address elements" do
|
113
|
+
it "creates electronic address elements" do
|
114
|
+
@xml.root do |xml|
|
115
|
+
RIFCS::electronic_addresses(address[:electronic], xml)
|
116
|
+
end
|
117
|
+
@xml.to_xml.should == <<EOX
|
118
|
+
<?xml version="1.0"?>
|
119
|
+
<root>
|
120
|
+
<electronic type="email">
|
121
|
+
<value>joe@example.com</value>
|
122
|
+
</electronic>
|
123
|
+
</root>
|
124
|
+
EOX
|
125
|
+
end
|
126
|
+
|
127
|
+
it "creates physical address elements" do
|
128
|
+
@xml.root do |xml|
|
129
|
+
RIFCS::physical_addresses(address[:physical], xml)
|
130
|
+
end
|
131
|
+
@xml.to_xml.should == <<EOX
|
132
|
+
<?xml version="1.0"?>
|
133
|
+
<root>
|
134
|
+
<physical type="postalAddress" xml:lang="">
|
135
|
+
<addressPart type="country">Austrlia</addressPart>
|
136
|
+
</physical>
|
137
|
+
</root>
|
138
|
+
EOX
|
139
|
+
end
|
140
|
+
|
141
|
+
it "creates address elements" do
|
142
|
+
@xml.root do |xml|
|
143
|
+
RIFCS::addresses([ address ], xml)
|
144
|
+
end
|
145
|
+
@xml.to_xml.should == <<EOX
|
146
|
+
<?xml version="1.0"?>
|
147
|
+
<root>
|
148
|
+
<address>
|
149
|
+
<electronic type="email">
|
150
|
+
<value>joe@example.com</value>
|
151
|
+
</electronic>
|
152
|
+
<physical type="postalAddress" xml:lang="">
|
153
|
+
<addressPart type="country">Austrlia</addressPart>
|
154
|
+
</physical>
|
155
|
+
</address>
|
156
|
+
</root>
|
157
|
+
EOX
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
it "creates temporal elements" do
|
162
|
+
end
|
163
|
+
|
164
|
+
describe "creates the coverage elements" do
|
165
|
+
let (:coverage) {
|
166
|
+
[
|
167
|
+
{
|
168
|
+
spatials: [ spatial ],
|
169
|
+
temporals: [
|
170
|
+
{
|
171
|
+
dates: [
|
172
|
+
{
|
173
|
+
value: Time.new(2012, 6, 14).utc,
|
174
|
+
date_format: 'UTC',
|
175
|
+
type: 'dateFrom'
|
176
|
+
},
|
177
|
+
{
|
178
|
+
value: Time.new(2013, 6, 14).utc,
|
179
|
+
date_format: 'UTC',
|
180
|
+
type: 'dateTo'
|
181
|
+
},
|
182
|
+
],
|
183
|
+
text: ['Self destructs in 1 year']
|
184
|
+
}
|
185
|
+
]
|
186
|
+
}
|
187
|
+
]
|
188
|
+
}
|
189
|
+
|
190
|
+
it "creates temporal elements" do
|
191
|
+
temporals = [
|
192
|
+
{
|
193
|
+
dates: [
|
194
|
+
{
|
195
|
+
value: Time.new(2012, 6, 14).utc,
|
196
|
+
date_format: 'UTC',
|
197
|
+
type: 'dateFrom'
|
198
|
+
},
|
199
|
+
{
|
200
|
+
value: Time.new(2013, 6, 14).utc,
|
201
|
+
date_format: 'UTC',
|
202
|
+
type: 'dateTo'
|
203
|
+
},
|
204
|
+
],
|
205
|
+
text: ['Self destructs in 1 year']
|
206
|
+
}
|
207
|
+
]
|
208
|
+
|
209
|
+
@xml.root do |xml|
|
210
|
+
RIFCS::temporals(temporals, xml)
|
211
|
+
end
|
212
|
+
@xml.to_xml.should == <<EOX
|
213
|
+
<?xml version="1.0"?>
|
214
|
+
<root>
|
215
|
+
<temporal>
|
216
|
+
<date dateFormat="UTC" type="dateFrom">2012-06-13 14:00:00 UTC</date>
|
217
|
+
<date dateFormat="UTC" type="dateTo">2013-06-13 14:00:00 UTC</date>
|
218
|
+
<text>Self destructs in 1 year</text>
|
219
|
+
</temporal>
|
220
|
+
</root>
|
221
|
+
EOX
|
222
|
+
end
|
223
|
+
|
224
|
+
it "creates coverage elements" do
|
225
|
+
@xml.root do |xml|
|
226
|
+
RIFCS::coverage(coverage, xml)
|
227
|
+
end
|
228
|
+
@xml.to_xml.should == <<EOX
|
229
|
+
<?xml version="1.0"?>
|
230
|
+
<root>
|
231
|
+
<coverage>
|
232
|
+
<spatial type="gml" xml:lang=""><gmlPoint gmlid="p21" srsName="http://www.opengis.net/def/crs/EPSG/0/4326"><gmlcoordinates>45.67, 88.56</gmlcoordinates></gmlPoint></spatial>
|
233
|
+
<temporal>
|
234
|
+
<date dateFormat="UTC" type="dateFrom">2012-06-13 14:00:00 UTC</date>
|
235
|
+
<date dateFormat="UTC" type="dateTo">2013-06-13 14:00:00 UTC</date>
|
236
|
+
<text>Self destructs in 1 year</text>
|
237
|
+
</temporal>
|
238
|
+
</coverage>
|
239
|
+
</root>
|
240
|
+
EOX
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
it "creates related_object elements" do
|
245
|
+
related_objects = {
|
246
|
+
has_association_with: [
|
247
|
+
{
|
248
|
+
key: 'b party',
|
249
|
+
relation: {
|
250
|
+
description: 'Supervisor'
|
251
|
+
}
|
252
|
+
}
|
253
|
+
],
|
254
|
+
is_member_of: [
|
255
|
+
{
|
256
|
+
key: 'some group'
|
257
|
+
}
|
258
|
+
]
|
259
|
+
}
|
260
|
+
|
261
|
+
@xml.root do |xml|
|
262
|
+
RIFCS::related_objects(related_objects, xml)
|
263
|
+
end
|
264
|
+
@xml.to_xml.should == <<EOX
|
265
|
+
<?xml version="1.0"?>
|
266
|
+
<root>
|
267
|
+
<relatedObject>
|
268
|
+
<key>b party</key>
|
269
|
+
<relation type="hasAssociationWith">
|
270
|
+
<description>Supervisor</description>
|
271
|
+
</relation>
|
272
|
+
</relatedObject>
|
273
|
+
<relatedObject>
|
274
|
+
<key>some group</key>
|
275
|
+
<relation type="isMemberOf"/>
|
276
|
+
</relatedObject>
|
277
|
+
</root>
|
278
|
+
EOX
|
279
|
+
end
|
280
|
+
|
281
|
+
it "creates related_info elements" do
|
282
|
+
related_info = [
|
283
|
+
{
|
284
|
+
type: 'publication',
|
285
|
+
identifier: {
|
286
|
+
value: '111',
|
287
|
+
type: 'isbn'
|
288
|
+
},
|
289
|
+
title: 'The Ordering of Things',
|
290
|
+
notes: 'Not available'
|
291
|
+
}
|
292
|
+
]
|
293
|
+
@xml.root do |xml|
|
294
|
+
RIFCS::related_info(related_info, xml)
|
295
|
+
end
|
296
|
+
@xml.to_xml.should == <<EOX
|
297
|
+
<?xml version="1.0"?>
|
298
|
+
<root>
|
299
|
+
<relatedInfo type="publication">
|
300
|
+
<identifier type="isbn">111</identifier>
|
301
|
+
<title>The Ordering of Things</title>
|
302
|
+
<notes>Not available</notes>
|
303
|
+
</relatedInfo>
|
304
|
+
</root>
|
305
|
+
EOX
|
306
|
+
end
|
307
|
+
|
308
|
+
it "creates rights elements" do
|
309
|
+
rights = [
|
310
|
+
{
|
311
|
+
rights_statement: {
|
312
|
+
rights_uri: 'http://www.intersect.org.au/policies',
|
313
|
+
value: 'Copyright 2012 Intersect Australia Ltd.'
|
314
|
+
},
|
315
|
+
licence: {
|
316
|
+
value: 'Attribution (CC BY)',
|
317
|
+
rights_uri: 'http://creativecommons.org/licenses/by/3.0',
|
318
|
+
type: ''
|
319
|
+
},
|
320
|
+
access_rights: {
|
321
|
+
value: 'Available to all without restriction'
|
322
|
+
}
|
323
|
+
}
|
324
|
+
]
|
325
|
+
|
326
|
+
@xml.root do |xml|
|
327
|
+
RIFCS::rights(rights, xml)
|
328
|
+
end
|
329
|
+
@xml.to_xml.should == <<EOX
|
330
|
+
<?xml version="1.0"?>
|
331
|
+
<root>
|
332
|
+
<rights>
|
333
|
+
<rightsStatement rightsUri="http://www.intersect.org.au/policies">Copyright 2012 Intersect Australia Ltd.</rightsStatement>
|
334
|
+
<licence rightsUri="http://creativecommons.org/licenses/by/3.0">Attribution (CC BY)</licence>
|
335
|
+
<accessRights rightsUri="">Available to all without restriction</accessRights>
|
336
|
+
</rights>
|
337
|
+
</root>
|
338
|
+
EOX
|
339
|
+
end
|
340
|
+
|
341
|
+
it "creates subject elements" do
|
342
|
+
subjects = [
|
343
|
+
{
|
344
|
+
value: '123456',
|
345
|
+
type: 'anzsrc-for',
|
346
|
+
term_identifier: 'http://www.abs.gov.au/Ausstats/abs@.nsf/Latestproducts/DE380FC648D83027CA257418000447D6?opendocument'
|
347
|
+
}
|
348
|
+
]
|
349
|
+
@xml.root do |xml|
|
350
|
+
RIFCS::subjects(subjects, xml)
|
351
|
+
end
|
352
|
+
@xml.to_xml.should == <<EOX
|
353
|
+
<?xml version="1.0"?>
|
354
|
+
<root>
|
355
|
+
<subject termIdentifier="http://www.abs.gov.au/Ausstats/abs@.nsf/Latestproducts/DE380FC648D83027CA257418000447D6?opendocument" type="anzsrc-for" xml:lang="">123456</subject>
|
356
|
+
</root>
|
357
|
+
EOX
|
358
|
+
end
|
359
|
+
|
360
|
+
it "creates existence_date elements" do
|
361
|
+
existence_dates = [
|
362
|
+
{
|
363
|
+
start_date: {
|
364
|
+
value: Time.new(2012, 6, 14).utc,
|
365
|
+
date_format: 'UTC'
|
366
|
+
},
|
367
|
+
end_date: {
|
368
|
+
value: Time.new(2013, 6, 14).utc,
|
369
|
+
date_format: 'UTC'
|
370
|
+
}
|
371
|
+
}
|
372
|
+
]
|
373
|
+
|
374
|
+
@xml.root do |xml|
|
375
|
+
RIFCS::existence_dates(existence_dates, xml)
|
376
|
+
end
|
377
|
+
@xml.to_xml.should == <<EOX
|
378
|
+
<?xml version="1.0"?>
|
379
|
+
<root>
|
380
|
+
<existenceDates>
|
381
|
+
<startDate dateFormat="UTC">2012-06-13 14:00:00 UTC</startDate>
|
382
|
+
<endDate dateFormat="UTC">2013-06-13 14:00:00 UTC</endDate>
|
383
|
+
</existenceDates>
|
384
|
+
</root>
|
385
|
+
EOX
|
386
|
+
end
|
387
|
+
|
388
|
+
end
|