om 3.0.5 → 3.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/om/version.rb +1 -1
- data/lib/om/xml/term.rb +6 -1
- data/spec/integration/serialization_spec.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d22a3f6b7dc5a7d6c75dac4d1bf14c60f5e0fc0c
|
4
|
+
data.tar.gz: 22198afe29d16339742f4ef4a9735121afa31136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a32c99b5587ae306791119c7e4e0c0b9e6d7ae7f8bb36e9ad4102c6de90c6a892daebc680083ab2609e9bf261f608f0d15d67dd66f30ec5263fc143d376f71b5
|
7
|
+
data.tar.gz: 4a4cb65a378cbef9ce02f38f05309916c6703978962112a01d7a08ff51ccad389f5efd78425b43531fada607b1cb25888f04f652e568f4e020f1e006e4999886
|
data/lib/om/version.rb
CHANGED
data/lib/om/xml/term.rb
CHANGED
@@ -94,7 +94,12 @@ module OM
|
|
94
94
|
when :date, :integer
|
95
95
|
val.to_s
|
96
96
|
when :time
|
97
|
-
|
97
|
+
begin
|
98
|
+
time = val.to_time
|
99
|
+
rescue ArgumentError
|
100
|
+
# In Rails 3, an invalid time raises ArgumentError, in Rails 4 it just returns nil
|
101
|
+
raise TypeMismatch, "Can't convert `#{val}` to time"
|
102
|
+
end
|
98
103
|
raise TypeMismatch, "Can't convert `#{val}` to time" if time.nil?
|
99
104
|
time.utc.iso8601
|
100
105
|
when :boolean
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require 'active_support/core_ext/string/conversions' # for String#to_time conversion
|
3
|
+
require 'active_support/core_ext/date_time/conversions' # for String#to_time conversion (only needed for Rails 3)
|
3
4
|
|
4
5
|
describe "element values" do
|
5
6
|
before(:all) do
|
@@ -64,6 +65,9 @@ EOF
|
|
64
65
|
it "raises a type mismatch error" do
|
65
66
|
expect { datastream.my_time = '' }.to raise_error OM::TypeMismatch
|
66
67
|
end
|
68
|
+
it "raises a type mismatch error" do
|
69
|
+
expect { datastream.my_time = 'Foo' }.to raise_error OM::TypeMismatch
|
70
|
+
end
|
67
71
|
end
|
68
72
|
end
|
69
73
|
|