|
2 | 2 |
|
3 | 3 | describe "Time#xmlschema" do |
4 | 4 | ruby_version_is "3.4" do |
5 | | - it "generates ISO-8601 strings in Z for UTC times" do |
6 | | - t = Time.utc(1985, 4, 12, 23, 20, 50, 521245) |
7 | | - t.xmlschema.should == "1985-04-12T23:20:50Z" |
8 | | - t.xmlschema(2).should == "1985-04-12T23:20:50.52Z" |
9 | | - t.xmlschema(9).should == "1985-04-12T23:20:50.521245000Z" |
10 | | - end |
11 | | - |
12 | | - it "generates ISO-8601 string with timezone offset for non-UTC times" do |
13 | | - t = Time.new(1985, 4, 12, 23, 20, 50, "+02:00") |
14 | | - t.xmlschema.should == "1985-04-12T23:20:50+02:00" |
15 | | - t.xmlschema(2).should == "1985-04-12T23:20:50.00+02:00" |
16 | | - end |
17 | | - |
18 | | - it "year is always at least 4 digits" do |
19 | | - t = Time.utc(12, 4, 12) |
20 | | - t.xmlschema.should == "0012-04-12T00:00:00Z" |
21 | | - end |
22 | | - |
23 | | - it "year can be more than 4 digits" do |
24 | | - t = Time.utc(40_000, 4, 12) |
25 | | - t.xmlschema.should == "40000-04-12T00:00:00Z" |
26 | | - end |
27 | | - |
28 | | - it "year can be negative" do |
29 | | - t = Time.utc(-2000, 4, 12) |
30 | | - t.xmlschema.should == "-2000-04-12T00:00:00Z" |
| 5 | + it "is an alias of Time#iso8601" do |
| 6 | + Time.instance_method(:xmlschema).should == Time.instance_method(:iso8601) |
31 | 7 | end |
32 | 8 | end |
33 | 9 | end |
0 commit comments