rubysl-date 0.0.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +0 -1
  3. data/.travis.yml +7 -0
  4. data/README.md +2 -2
  5. data/Rakefile +0 -1
  6. data/lib/date.rb +1 -0
  7. data/lib/date/format.rb +1207 -0
  8. data/lib/rubysl/date.rb +2 -0
  9. data/lib/rubysl/date/date.rb +1765 -0
  10. data/lib/{rubysl-date → rubysl/date}/version.rb +1 -1
  11. data/rubysl-date.gemspec +18 -18
  12. data/spec/date/accessor_spec.rb +90 -0
  13. data/spec/date/add_month_spec.rb +29 -0
  14. data/spec/date/add_spec.rb +29 -0
  15. data/spec/date/ajd_spec.rb +5 -0
  16. data/spec/date/ajd_to_amjd_spec.rb +5 -0
  17. data/spec/date/ajd_to_jd_spec.rb +5 -0
  18. data/spec/date/amjd_spec.rb +5 -0
  19. data/spec/date/amjd_to_ajd_spec.rb +5 -0
  20. data/spec/date/append_spec.rb +5 -0
  21. data/spec/date/asctime_spec.rb +5 -0
  22. data/spec/date/boat_spec.rb +23 -0
  23. data/spec/date/case_compare_spec.rb +5 -0
  24. data/spec/date/civil_spec.rb +11 -0
  25. data/spec/date/civil_to_jd_spec.rb +16 -0
  26. data/spec/date/commercial_spec.rb +17 -0
  27. data/spec/date/commercial_to_jd_spec.rb +5 -0
  28. data/spec/date/comparison_spec.rb +5 -0
  29. data/spec/date/constants_spec.rb +110 -0
  30. data/spec/date/conversions_spec.rb +154 -0
  31. data/spec/date/ctime_spec.rb +5 -0
  32. data/spec/date/cwday_spec.rb +5 -0
  33. data/spec/date/cweek_spec.rb +5 -0
  34. data/spec/date/cwyear_spec.rb +5 -0
  35. data/spec/date/day_fraction_spec.rb +5 -0
  36. data/spec/date/day_fraction_to_time_spec.rb +5 -0
  37. data/spec/date/day_spec.rb +5 -0
  38. data/spec/date/downto_spec.rb +17 -0
  39. data/spec/date/england_spec.rb +5 -0
  40. data/spec/date/eql_spec.rb +11 -0
  41. data/spec/date/exist1_spec.rb +8 -0
  42. data/spec/date/exist2_spec.rb +8 -0
  43. data/spec/date/exist3_spec.rb +8 -0
  44. data/spec/date/exist_spec.rb +8 -0
  45. data/spec/date/existw_spec.rb +8 -0
  46. data/spec/date/format/bag/method_missing_spec.rb +5 -0
  47. data/spec/date/format/bag/to_hash_spec.rb +5 -0
  48. data/spec/date/gregorian_leap_spec.rb +15 -0
  49. data/spec/date/gregorian_spec.rb +46 -0
  50. data/spec/date/hash_spec.rb +7 -0
  51. data/spec/date/infinity/abs_spec.rb +5 -0
  52. data/spec/date/infinity/coerce_spec.rb +5 -0
  53. data/spec/date/infinity/comparison_spec.rb +5 -0
  54. data/spec/date/infinity/d_spec.rb +5 -0
  55. data/spec/date/infinity/finite_spec.rb +5 -0
  56. data/spec/date/infinity/infinite_spec.rb +5 -0
  57. data/spec/date/infinity/nan_spec.rb +5 -0
  58. data/spec/date/infinity/uminus_spec.rb +5 -0
  59. data/spec/date/infinity/uplus_spec.rb +5 -0
  60. data/spec/date/infinity/zero_spec.rb +5 -0
  61. data/spec/date/infinity_spec.rb +76 -0
  62. data/spec/date/inspect_spec.rb +5 -0
  63. data/spec/date/italy_spec.rb +5 -0
  64. data/spec/date/jd_spec.rb +14 -0
  65. data/spec/date/jd_to_ajd_spec.rb +5 -0
  66. data/spec/date/jd_to_civil_spec.rb +5 -0
  67. data/spec/date/jd_to_commercial_spec.rb +5 -0
  68. data/spec/date/jd_to_ld_spec.rb +5 -0
  69. data/spec/date/jd_to_mjd_spec.rb +5 -0
  70. data/spec/date/jd_to_ordinal_spec.rb +5 -0
  71. data/spec/date/jd_to_wday_spec.rb +5 -0
  72. data/spec/date/julian_leap_spec.rb +14 -0
  73. data/spec/date/julian_spec.rb +47 -0
  74. data/spec/date/ld_spec.rb +5 -0
  75. data/spec/date/ld_to_jd_spec.rb +5 -0
  76. data/spec/date/leap_spec.rb +9 -0
  77. data/spec/date/mday_spec.rb +5 -0
  78. data/spec/date/minus_month_spec.rb +22 -0
  79. data/spec/date/minus_spec.rb +29 -0
  80. data/spec/date/mjd_spec.rb +5 -0
  81. data/spec/date/mjd_to_jd_spec.rb +5 -0
  82. data/spec/date/mon_spec.rb +5 -0
  83. data/spec/date/month_spec.rb +5 -0
  84. data/spec/date/new0_spec.rb +8 -0
  85. data/spec/date/new1_spec.rb +8 -0
  86. data/spec/date/new2_spec.rb +8 -0
  87. data/spec/date/new3_spec.rb +8 -0
  88. data/spec/date/new_spec.rb +13 -0
  89. data/spec/date/new_start_spec.rb +5 -0
  90. data/spec/date/newsg_spec.rb +7 -0
  91. data/spec/date/neww_spec.rb +7 -0
  92. data/spec/date/next_spec.rb +5 -0
  93. data/spec/date/ns_spec.rb +11 -0
  94. data/spec/date/ordinal_spec.rb +7 -0
  95. data/spec/date/ordinal_to_jd_spec.rb +5 -0
  96. data/spec/date/os_spec.rb +11 -0
  97. data/spec/date/parse_spec.rb +173 -0
  98. data/spec/date/plus_spec.rb +19 -0
  99. data/spec/date/relationship_spec.rb +19 -0
  100. data/spec/date/right_shift_spec.rb +5 -0
  101. data/spec/date/sg_spec.rb +7 -0
  102. data/spec/date/shared/civil.rb +69 -0
  103. data/spec/date/shared/commercial.rb +62 -0
  104. data/spec/date/shared/jd.rb +14 -0
  105. data/spec/date/shared/new_bang.rb +14 -0
  106. data/spec/date/shared/ordinal.rb +42 -0
  107. data/spec/date/shared/parse.rb +54 -0
  108. data/spec/date/shared/parse_eu.rb +48 -0
  109. data/spec/date/shared/parse_us.rb +61 -0
  110. data/spec/date/shared/valid_civil.rb +69 -0
  111. data/spec/date/shared/valid_commercial.rb +66 -0
  112. data/spec/date/shared/valid_jd.rb +36 -0
  113. data/spec/date/shared/valid_ordinal.rb +60 -0
  114. data/spec/date/start_spec.rb +5 -0
  115. data/spec/date/step_spec.rb +55 -0
  116. data/spec/date/strftime_spec.rb +204 -0
  117. data/spec/date/strptime_spec.rb +161 -0
  118. data/spec/date/succ_spec.rb +5 -0
  119. data/spec/date/time_to_day_fraction_spec.rb +5 -0
  120. data/spec/date/to_s_spec.rb +5 -0
  121. data/spec/date/today_spec.rb +5 -0
  122. data/spec/date/upto_spec.rb +15 -0
  123. data/spec/date/valid_civil_spec.rb +9 -0
  124. data/spec/date/valid_commercial_spec.rb +9 -0
  125. data/spec/date/valid_date_spec.rb +6 -0
  126. data/spec/date/valid_jd_spec.rb +9 -0
  127. data/spec/date/valid_ordinal_spec.rb +9 -0
  128. data/spec/date/valid_time_spec.rb +5 -0
  129. data/spec/date/wday_spec.rb +5 -0
  130. data/spec/date/yday_spec.rb +5 -0
  131. data/spec/date/year_spec.rb +5 -0
  132. data/spec/date/zone_to_diff_spec.rb +5 -0
  133. data/spec/datetime/_strptime_spec.rb +5 -0
  134. data/spec/datetime/civil_spec.rb +5 -0
  135. data/spec/datetime/commercial_spec.rb +5 -0
  136. data/spec/datetime/hour_spec.rb +77 -0
  137. data/spec/datetime/httpdate_spec.rb +5 -0
  138. data/spec/datetime/iso8601_spec.rb +9 -0
  139. data/spec/datetime/jd_spec.rb +5 -0
  140. data/spec/datetime/jisx0301_spec.rb +9 -0
  141. data/spec/datetime/min_spec.rb +5 -0
  142. data/spec/datetime/minute_spec.rb +7 -0
  143. data/spec/datetime/new_offset_spec.rb +5 -0
  144. data/spec/datetime/new_spec.rb +52 -0
  145. data/spec/datetime/now_spec.rb +7 -0
  146. data/spec/datetime/offset_spec.rb +5 -0
  147. data/spec/datetime/ordinal_spec.rb +5 -0
  148. data/spec/datetime/parse_spec.rb +166 -0
  149. data/spec/datetime/rfc2822_spec.rb +5 -0
  150. data/spec/datetime/rfc3339_spec.rb +9 -0
  151. data/spec/datetime/rfc822_spec.rb +5 -0
  152. data/spec/datetime/sec_fraction_spec.rb +5 -0
  153. data/spec/datetime/sec_spec.rb +5 -0
  154. data/spec/datetime/second_fraction_spec.rb +5 -0
  155. data/spec/datetime/second_spec.rb +7 -0
  156. data/spec/datetime/shared/min.rb +77 -0
  157. data/spec/datetime/shared/sec.rb +65 -0
  158. data/spec/datetime/strftime_spec.rb +25 -0
  159. data/spec/datetime/strptime_spec.rb +5 -0
  160. data/spec/datetime/to_date_spec.rb +5 -0
  161. data/spec/datetime/to_datetime_spec.rb +5 -0
  162. data/spec/datetime/to_s_spec.rb +5 -0
  163. data/spec/datetime/to_time_spec.rb +5 -0
  164. data/spec/datetime/xmlschema_spec.rb +9 -0
  165. data/spec/datetime/zone_spec.rb +5 -0
  166. metadata +376 -88
  167. data/lib/rubysl-date.rb +0 -7
@@ -0,0 +1,9 @@
1
+ require File.expand_path('../shared/valid_ordinal', __FILE__)
2
+ require 'date'
3
+
4
+ describe "Date.valid_ordinal?" do
5
+
6
+ it_behaves_like :date_valid_ordinal?, :valid_ordinal?
7
+
8
+ end
9
+
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "Date.valid_time?" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "Date#wday" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "Date#yday" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "Date#year" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "Date.zone_to_diff" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "DateTime._strptime" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.civil" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.commercial" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,77 @@
1
+ require 'mspec/helpers/datetime'
2
+ require 'date'
3
+
4
+ describe "DateTime#hour" do
5
+ it "returns 0 if no argument is passed" do
6
+ DateTime.new.hour.should == 0
7
+ end
8
+
9
+ it "returns the hour given as argument" do
10
+ new_datetime(:hour => 5).hour.should == 5
11
+ end
12
+
13
+ it "adds 24 to negative hours" do
14
+ new_datetime(:hour => -10).hour.should == 14
15
+ end
16
+
17
+ ruby_version_is "" ... "1.9.3" do
18
+ it "returns the absolute value of a Rational" do
19
+ new_datetime(:hour => 1 + Rational(1,2)).hour.should == 1
20
+ end
21
+ end
22
+
23
+ ruby_version_is "1.9.3" do
24
+ it "raises an error for Rational" do
25
+ lambda { new_datetime(:hour => 1 + Rational(1,2)) }.should raise_error(ArgumentError)
26
+ end
27
+ end
28
+
29
+ ruby_version_is "" .. "1.9" do
30
+ it "raises an error for Float" do
31
+ lambda { new_datetime :hour => 1.5 }.should raise_error(NoMethodError)
32
+ end
33
+ end
34
+
35
+ ruby_version_is "1.9" ... "1.9.3" do
36
+ it "returns the absolute value of a Float" do
37
+ new_datetime(:hour => 1.5).hour.should == 1
38
+ end
39
+ end
40
+
41
+ ruby_version_is "1.9.3" do
42
+ it "raises an error for Float" do
43
+ lambda { new_datetime(:hour => 1.5).hour }.should raise_error(ArgumentError)
44
+ end
45
+ end
46
+
47
+ ruby_version_is "" ... "1.9.3" do
48
+ it "returns a fraction of a day" do
49
+ new_datetime(:day => 1 + Rational(1,2)).hour.should == 12
50
+ end
51
+ end
52
+
53
+ ruby_version_is "1.9.3" do
54
+ it "raises an error for Rational" do
55
+ lambda { new_datetime(:day => 1 + Rational(1,2)) }.should raise_error(ArgumentError)
56
+ end
57
+ end
58
+
59
+ it "raises an error, when the hour is smaller than -24" do
60
+ lambda { new_datetime(:hour => -25) }.should raise_error(ArgumentError)
61
+ end
62
+
63
+ it "raises an error, when the hour is larger than 24" do
64
+ lambda { new_datetime(:hour => 25) }.should raise_error(ArgumentError)
65
+ end
66
+
67
+ it "raises an error for hour fractions smaller than -24" do
68
+ lambda { new_datetime(:hour => -24 - Rational(1,2)) }.should(
69
+ raise_error(ArgumentError))
70
+ end
71
+
72
+ it "adds 1 to day, when 24 hours given" do
73
+ d = new_datetime :day => 1, :hour => 24
74
+ d.hour.should == 0
75
+ d.day.should == 2
76
+ end
77
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.httpdate" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.iso8601" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
6
+
7
+ describe "DateTime#iso8601" do
8
+ it "needs to be reviewed for spec completeness"
9
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.jd" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.jisx0301" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
6
+
7
+ describe "DateTime#jisx0301" do
8
+ it "needs to be reviewed for spec completeness"
9
+ end
@@ -0,0 +1,5 @@
1
+ require File.expand_path('../shared/min', __FILE__)
2
+
3
+ describe "DateTime.min" do
4
+ it_behaves_like :datetime_min, :min
5
+ end
@@ -0,0 +1,7 @@
1
+ require File.expand_path('../shared/min', __FILE__)
2
+
3
+ describe "DateTime.minute" do
4
+ ruby_version_is '1.9' do
5
+ it_behaves_like :datetime_min, :minute
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "DateTime#new_offset" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,52 @@
1
+ require 'mspec/helpers/hash'
2
+ require 'date'
3
+
4
+ describe "DateTime.new" do
5
+ it "sets all values to default if passed no arguments" do
6
+ d = DateTime.new
7
+ d.year.should == -4712
8
+ d.month.should == 1
9
+ d.day.should == 1
10
+ d.hour.should == 0
11
+ d.min.should == 0
12
+ d.sec.should == 0
13
+ d.sec_fraction.should == 0
14
+ d.offset.should == 0
15
+ end
16
+
17
+ it "takes the first argument as year" do
18
+ DateTime.new(2011).year.should == 2011
19
+ end
20
+
21
+ it "takes the second argument as month" do
22
+ DateTime.new(2011, 2).month.should == 2
23
+ end
24
+
25
+ it "takes the third argument as day" do
26
+ DateTime.new(2011, 2, 3).day.should == 3
27
+ end
28
+
29
+ it "takes the forth argument as hour" do
30
+ DateTime.new(2011, 2, 3, 4).hour.should == 4
31
+ end
32
+
33
+ it "takes the fifth argument as minute" do
34
+ DateTime.new(1, 2, 3, 4, 5).min.should == 5
35
+ end
36
+
37
+ it "takes the sixth argument as second" do
38
+ DateTime.new(1, 2, 3, 4, 5, 6).sec.should == 6
39
+ end
40
+
41
+ it "takes the seventh argument as an offset" do
42
+ DateTime.new(1, 2, 3, 4, 5, 6, 0.7).offset.should == 0.7
43
+ end
44
+
45
+ it "takes the eigth argument as the date of calendar reform" do
46
+ DateTime.new(1, 2, 3, 4, 5, 6, 0.7, Date::ITALY).start().should == Date::ITALY
47
+ end
48
+
49
+ it "raises an error on invalid arguments" do
50
+ lambda { new_datetime(:minute => 999) }.should raise_error(ArgumentError)
51
+ end
52
+ end
@@ -0,0 +1,7 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.now" do
4
+ it "creates an instance of DateTime" do
5
+ DateTime.now.should be_an_instance_of(DateTime)
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "DateTime#offset" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.ordinal" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end
@@ -0,0 +1,166 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.parse" do
4
+
5
+ it "parses a day name into a DateTime object" do
6
+ d = DateTime.parse("friday")
7
+ d.should == DateTime.commercial(d.cwyear, d.cweek, 5)
8
+ end
9
+
10
+ it "parses a month name into a DateTime object" do
11
+ d = DateTime.parse("october")
12
+ d.should == DateTime.civil(Date.today.year, 10)
13
+ end
14
+
15
+ it "parses a month day into a DateTime object" do
16
+ d = DateTime.parse("5th")
17
+ d.should == DateTime.civil(Date.today.year, Date.today.month, 5)
18
+ end
19
+
20
+ # Specs using numbers
21
+ it "throws an argument error for a single digit" do
22
+ lambda{ DateTime.parse("1") }.should raise_error(ArgumentError)
23
+ end
24
+
25
+ it "parses DD as month day number" do
26
+ d = DateTime.parse("10")
27
+ d.should == DateTime.civil(Date.today.year, Date.today.month, 10)
28
+ end
29
+
30
+ it "parses DDD as year day number" do
31
+ d = DateTime.parse("100")
32
+ if DateTime.gregorian_leap?(Date.today.year)
33
+ d.should == DateTime.civil(Date.today.year, 4, 9)
34
+ else
35
+ d.should == DateTime.civil(Date.today.year, 4, 10)
36
+ end
37
+ end
38
+
39
+ it "parses MMDD as month and day" do
40
+ d = DateTime.parse("1108")
41
+ d.should == DateTime.civil(Date.today.year, 11, 8)
42
+ end
43
+
44
+ it "parses YYYYMMDD as year, month and day" do
45
+ d = DateTime.parse("20121108")
46
+ d.should == DateTime.civil(2012, 11, 8)
47
+ end
48
+
49
+ describe "YYYY-MM-DDTHH:MM:SS format" do
50
+ it "parses YYYY-MM-DDTHH:MM:SS into a DateTime object" do
51
+ d = DateTime.parse("2012-11-08T15:43:59")
52
+ d.should == DateTime.civil(2012, 11, 8, 15, 43, 59)
53
+ end
54
+
55
+ it "throws an argument error for invalid month values" do
56
+ lambda{DateTime.parse("2012-13-08T15:43:59")}.should raise_error(ArgumentError)
57
+ end
58
+
59
+ it "throws an argument error for invalid day values" do
60
+ lambda{DateTime.parse("2012-12-32T15:43:59")}.should raise_error(ArgumentError)
61
+ end
62
+
63
+ it "throws an argument error for invalid hour values" do
64
+ lambda{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
65
+ end
66
+
67
+ it "throws an argument error for invalid minute values" do
68
+ lambda{DateTime.parse("2012-12-31T25:43:59")}.should raise_error(ArgumentError)
69
+ end
70
+
71
+ ruby_version_is ""..."2.0" do
72
+ #this seems like unexpected behaviour why not raise an ArgumentError?
73
+ #also according to ISO8601 seconds can be 60 to allow for a leap second
74
+ it "truncates seconds down to 59" do
75
+ d = DateTime.parse("2012-11-08T15:43:61")
76
+
77
+ d.should == DateTime.civil(2012, 11, 8, 15, 43, 59)
78
+ end
79
+ end
80
+
81
+ ruby_version_is "2.0" do
82
+ it "throws an argument error for invalid second values" do
83
+ lambda{DateTime.parse("2012-11-08T15:43:61")}.should raise_error(ArgumentError)
84
+ end
85
+ end
86
+
87
+ end
88
+
89
+ ruby_version_is "" ... "1.9" do
90
+ it "parses YYDDD as year and day number" do
91
+ d = DateTime.parse("10100")
92
+ d.should == DateTime.civil(10, 4, 10)
93
+ end
94
+
95
+ it "parses YYMMDD as year, month and day" do
96
+ d = DateTime.parse("201023")
97
+ d.should == DateTime.civil(20, 10, 23)
98
+ end
99
+ end
100
+
101
+ ruby_version_is "1.9" do
102
+ it "parses YYDDD as year and day number in 1969--2068" do
103
+ d = DateTime.parse("10100")
104
+ d.should == DateTime.civil(2010, 4, 10)
105
+ end
106
+
107
+ it "parses YYMMDD as year, month and day in 1969--2068" do
108
+ d = DateTime.parse("201023")
109
+ d.should == DateTime.civil(2020, 10, 23)
110
+ end
111
+ end
112
+
113
+ it "parses YYYYDDD as year and day number" do
114
+ d = DateTime.parse("1910100")
115
+ d.should == DateTime.civil(1910, 4, 10)
116
+ end
117
+
118
+ it "parses YYYYMMDD as year, month and day number" do
119
+ d = DateTime.parse("19101101")
120
+ d.should == DateTime.civil(1910, 11, 1)
121
+ end
122
+ end
123
+
124
+ ruby_version_is "1.8.7" do
125
+ describe "DateTime.parse(.)" do
126
+ it "parses YYYY.MM.DD into a DateTime object" do
127
+ d = DateTime.parse("2007.10.01")
128
+ d.year.should == 2007
129
+ d.month.should == 10
130
+ d.day.should == 1
131
+ end
132
+
133
+ it "parses DD.MM.YYYY into a DateTime object" do
134
+ d = DateTime.parse("10.01.2007")
135
+ d.year.should == 2007
136
+ d.month.should == 1
137
+ d.day.should == 10
138
+ end
139
+
140
+ ruby_version_is "" ... "1.9" do
141
+ it "parses YY.MM.DD into a DateTime object using the year YY" do
142
+ d = DateTime.parse("10.01.07")
143
+ d.year.should == 10
144
+ d.month.should == 1
145
+ d.day.should == 7
146
+ end
147
+ end
148
+
149
+ ruby_version_is "1.9" do
150
+ it "parses YY.MM.DD into a DateTime object using the year 20YY" do
151
+ d = DateTime.parse("10.01.07")
152
+ d.year.should == 2010
153
+ d.month.should == 1
154
+ d.day.should == 7
155
+ end
156
+ end
157
+
158
+ it "parses YY.MM.DD using the year digits as 20YY when given true as additional argument" do
159
+ d = DateTime.parse("10.01.07", true)
160
+ d.year.should == 2010
161
+ d.month.should == 1
162
+ d.day.should == 7
163
+ end
164
+ end
165
+
166
+ end
@@ -0,0 +1,5 @@
1
+ require 'date'
2
+
3
+ describe "DateTime.rfc2822" do
4
+ it "needs to be reviewed for spec completeness"
5
+ end