aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_with_zone_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2014-01-26 21:22:23 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2014-01-26 21:25:54 +0000
commitdd339bb0adc3bb1f0c376c4352f769ae2ab02b62 (patch)
tree84d91b89bcc7ea9861edd5a3ce8f57772f34fff4 /activesupport/test/core_ext/time_with_zone_test.rb
parentc0965004486f2ea5a9656ba718a3377c9614f97d (diff)
downloadrails-dd339bb0adc3bb1f0c376c4352f769ae2ab02b62.tar.gz
rails-dd339bb0adc3bb1f0c376c4352f769ae2ab02b62.tar.bz2
rails-dd339bb0adc3bb1f0c376c4352f769ae2ab02b62.zip
Make ActiveSupport::TimeWithZone#xmlschema consistent
Both Time#xmlschema and DateTime#xmlschema can accept nil values for the fraction_digits parameter. This commit makes this so for TimeWithZone values as well.
Diffstat (limited to 'activesupport/test/core_ext/time_with_zone_test.rb')
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index e9bf43667a..8e25f1e2f2 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -111,6 +111,10 @@ class TimeWithZoneTest < ActiveSupport::TestCase
assert_equal "1999-12-31T19:00:00.001234-05:00", @twz.xmlschema(12)
end
+ def test_xmlschema_with_nil_fractional_seconds
+ assert_equal "1999-12-31T19:00:00-05:00", @twz.xmlschema(nil)
+ end
+
def test_to_yaml
assert_match(/^--- 2000-01-01 00:00:00(\.0+)?\s*Z\n/, @twz.to_yaml)
end