xml-mapping_extensions 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e73d6da3501c828dfcc61abf5e57819fafe02503
|
4
|
+
data.tar.gz: 658f243f24e3893e5ef5c9db5119253590a35e80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5491021c83c519e27adeb55c3b4f2b965a75818c1446ade0028ffbf47e7cac9e227cc63448856945cca2852c48afdfcc9a3f0679bf6fd4dcb74b00c798fdc9f0
|
7
|
+
data.tar.gz: ec5cb7318df6f5e049eb0eaec50f9efff2047060d0b7b772cf5d6770408d064b9e74227ead666aedde8d14183ab5074a763c6fddec22e028a189fb90e4f2649a
|
data/CHANGES.md
CHANGED
@@ -28,6 +28,7 @@ module XML
|
|
28
28
|
# @return [String] the value as an XML Schema date string, without
|
29
29
|
# time zone information unless {#zulu} is set
|
30
30
|
def to_xml_text(value)
|
31
|
+
value = value.to_date if value.respond_to?(:to_date)
|
31
32
|
text = value.iso8601 # use iso8601 instead of xmlschema in case of ActiveSupport shenanigans
|
32
33
|
(zulu && !text.end_with?('Z')) ? "#{text}Z" : text
|
33
34
|
end
|
@@ -13,8 +13,8 @@ module XML
|
|
13
13
|
load_from_xml(doc.root)
|
14
14
|
end
|
15
15
|
end
|
16
|
-
describe DateNode do
|
17
16
|
|
17
|
+
describe DateNode do
|
18
18
|
def to_date(str)
|
19
19
|
DateNodeSpecElem.from_str(str).date
|
20
20
|
end
|
@@ -57,12 +57,36 @@ module XML
|
|
57
57
|
expect(actual).to eq(expected)
|
58
58
|
end
|
59
59
|
|
60
|
+
it 'truncates a Time to a date' do
|
61
|
+
expected = '2002-09-24'
|
62
|
+
actual = to_text(Time.utc(2002, 9, 24, 0, 1, 2))
|
63
|
+
expect(actual).to eq(expected)
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'truncates a DateTime to a Date' do
|
67
|
+
expected = '2002-09-24'
|
68
|
+
actual = to_text(DateTime.new(2002, 9, 24, 0, 1, 2))
|
69
|
+
expect(actual).to eq(expected)
|
70
|
+
end
|
71
|
+
|
60
72
|
it 'outputs a UTC "zulu" date (time zone designator "Z")' do
|
61
73
|
expected = '2002-09-24Z'
|
62
74
|
actual = to_zulu_text(Date.new(2002, 9, 24))
|
63
75
|
expect(actual).to eq(expected)
|
64
76
|
end
|
65
77
|
|
78
|
+
it 'truncates a DateTime to a zulu date' do
|
79
|
+
expected = '2002-09-24Z'
|
80
|
+
actual = to_zulu_text(DateTime.new(2002, 9, 24, 0, 1, 2))
|
81
|
+
expect(actual).to eq(expected)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'truncates a Time to a zulu date' do
|
85
|
+
expected = '2002-09-24Z'
|
86
|
+
actual = to_zulu_text(Time.utc(2002, 9, 24, 0, 1, 2))
|
87
|
+
expect(actual).to eq(expected)
|
88
|
+
end
|
89
|
+
|
66
90
|
describe 'works with Date.today' do
|
67
91
|
it 'as plain date' do
|
68
92
|
date = Date.today
|
@@ -47,6 +47,11 @@ module XML
|
|
47
47
|
expect { to_mime_type(mt_str) }.to raise_error(MIME::Type::InvalidContentType)
|
48
48
|
end
|
49
49
|
|
50
|
+
it 'parses a nil mime-type as nil' do
|
51
|
+
elem = MimeTypeSpecElem.parse_xml('<elem/>')
|
52
|
+
expect(elem.mime_type).to be_nil
|
53
|
+
end
|
54
|
+
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xml-mapping_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Moles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|