aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_with_zone_test.rb
diff options
context:
space:
mode:
authorAndrew White <andrew.white@unboxed.co>2017-03-03 20:14:22 +0000
committerAndrew White <andrew.white@unboxed.co>2017-03-03 21:53:13 +0000
commitf0aeecda1450ba17701ccba68e5a796ce4ac4c3b (patch)
tree5577db6b1f3424711bf3b35493ba55cf95ae86b7 /activesupport/test/core_ext/time_with_zone_test.rb
parent08e05d4a49c1ba1327e3e6821eba1f0c93361ab2 (diff)
downloadrails-f0aeecda1450ba17701ccba68e5a796ce4ac4c3b.tar.gz
rails-f0aeecda1450ba17701ccba68e5a796ce4ac4c3b.tar.bz2
rails-f0aeecda1450ba17701ccba68e5a796ce4ac4c3b.zip
Add `rfc3339` aliases to `xmlschema`
For naming consistency when using the RFC 3339 profile of ISO 8601 in applications.
Diffstat (limited to 'activesupport/test/core_ext/time_with_zone_test.rb')
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb10
1 files changed, 10 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 1534daacb9..3cc29ca040 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -144,6 +144,16 @@ class TimeWithZoneTest < ActiveSupport::TestCase
assert_equal "1999-12-31T19:00:00-05:00", @twz.xmlschema(nil)
end
+ def test_iso8601_with_fractional_seconds
+ @twz += Rational(1, 8)
+ assert_equal "1999-12-31T19:00:00.125-05:00", @twz.iso8601(3)
+ end
+
+ def test_rfc3339_with_fractional_seconds
+ @twz += Rational(1, 8)
+ assert_equal "1999-12-31T19:00:00.125-05:00", @twz.rfc3339(3)
+ end
+
def test_to_yaml
yaml = <<-EOF.strip_heredoc
--- !ruby/object:ActiveSupport::TimeWithZone