gitlab-chronic 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.gitlab-ci.yml +14 -0
  4. data/.travis.yml +10 -0
  5. data/Gemfile +3 -0
  6. data/HISTORY.md +252 -0
  7. data/LICENSE +21 -0
  8. data/README.md +188 -0
  9. data/Rakefile +68 -0
  10. data/chronic.gemspec +25 -0
  11. data/lib/chronic.rb +155 -0
  12. data/lib/chronic/date.rb +81 -0
  13. data/lib/chronic/definition.rb +128 -0
  14. data/lib/chronic/dictionary.rb +36 -0
  15. data/lib/chronic/handler.rb +97 -0
  16. data/lib/chronic/handlers.rb +672 -0
  17. data/lib/chronic/mini_date.rb +38 -0
  18. data/lib/chronic/parser.rb +222 -0
  19. data/lib/chronic/repeaters/repeater_day.rb +54 -0
  20. data/lib/chronic/repeaters/repeater_day_name.rb +53 -0
  21. data/lib/chronic/repeaters/repeater_day_portion.rb +109 -0
  22. data/lib/chronic/repeaters/repeater_fortnight.rb +72 -0
  23. data/lib/chronic/repeaters/repeater_hour.rb +59 -0
  24. data/lib/chronic/repeaters/repeater_minute.rb +59 -0
  25. data/lib/chronic/repeaters/repeater_month.rb +80 -0
  26. data/lib/chronic/repeaters/repeater_month_name.rb +95 -0
  27. data/lib/chronic/repeaters/repeater_quarter.rb +59 -0
  28. data/lib/chronic/repeaters/repeater_quarter_name.rb +40 -0
  29. data/lib/chronic/repeaters/repeater_season.rb +111 -0
  30. data/lib/chronic/repeaters/repeater_season_name.rb +43 -0
  31. data/lib/chronic/repeaters/repeater_second.rb +43 -0
  32. data/lib/chronic/repeaters/repeater_time.rb +159 -0
  33. data/lib/chronic/repeaters/repeater_week.rb +76 -0
  34. data/lib/chronic/repeaters/repeater_weekday.rb +86 -0
  35. data/lib/chronic/repeaters/repeater_weekend.rb +67 -0
  36. data/lib/chronic/repeaters/repeater_year.rb +78 -0
  37. data/lib/chronic/season.rb +26 -0
  38. data/lib/chronic/span.rb +31 -0
  39. data/lib/chronic/tag.rb +89 -0
  40. data/lib/chronic/tags/grabber.rb +29 -0
  41. data/lib/chronic/tags/ordinal.rb +52 -0
  42. data/lib/chronic/tags/pointer.rb +28 -0
  43. data/lib/chronic/tags/repeater.rb +160 -0
  44. data/lib/chronic/tags/scalar.rb +89 -0
  45. data/lib/chronic/tags/separator.rb +123 -0
  46. data/lib/chronic/tags/sign.rb +35 -0
  47. data/lib/chronic/tags/time_zone.rb +32 -0
  48. data/lib/chronic/time.rb +40 -0
  49. data/lib/chronic/token.rb +61 -0
  50. data/lib/chronic/tokenizer.rb +38 -0
  51. data/lib/chronic/version.rb +3 -0
  52. data/test/helper.rb +12 -0
  53. data/test/test_chronic.rb +203 -0
  54. data/test/test_daylight_savings.rb +122 -0
  55. data/test/test_handler.rb +128 -0
  56. data/test/test_mini_date.rb +32 -0
  57. data/test/test_parsing.rb +1537 -0
  58. data/test/test_repeater_day_name.rb +51 -0
  59. data/test/test_repeater_day_portion.rb +254 -0
  60. data/test/test_repeater_fortnight.rb +62 -0
  61. data/test/test_repeater_hour.rb +68 -0
  62. data/test/test_repeater_minute.rb +34 -0
  63. data/test/test_repeater_month.rb +50 -0
  64. data/test/test_repeater_month_name.rb +56 -0
  65. data/test/test_repeater_quarter.rb +70 -0
  66. data/test/test_repeater_quarter_name.rb +198 -0
  67. data/test/test_repeater_season.rb +40 -0
  68. data/test/test_repeater_time.rb +88 -0
  69. data/test/test_repeater_week.rb +115 -0
  70. data/test/test_repeater_weekday.rb +55 -0
  71. data/test/test_repeater_weekend.rb +74 -0
  72. data/test/test_repeater_year.rb +69 -0
  73. data/test/test_span.rb +23 -0
  74. data/test/test_token.rb +31 -0
  75. metadata +215 -0
@@ -0,0 +1,51 @@
1
+ require 'helper'
2
+
3
+ class TestRepeaterDayName < TestCase
4
+
5
+ def setup
6
+ @now = Time.local(2006, 8, 16, 14, 0, 0, 0)
7
+ end
8
+
9
+ def test_match
10
+ token = Chronic::Token.new('saturday')
11
+ repeater = Chronic::Repeater.scan_for_day_names(token)
12
+ assert_equal Chronic::RepeaterDayName, repeater.class
13
+ assert_equal :saturday, repeater.type
14
+
15
+ token = Chronic::Token.new('sunday')
16
+ repeater = Chronic::Repeater.scan_for_day_names(token)
17
+ assert_equal Chronic::RepeaterDayName, repeater.class
18
+ assert_equal :sunday, repeater.type
19
+ end
20
+
21
+ def test_next_future
22
+ mondays = Chronic::RepeaterDayName.new(:monday)
23
+ mondays.start = @now
24
+
25
+ span = mondays.next(:future)
26
+
27
+ assert_equal Time.local(2006, 8, 21), span.begin
28
+ assert_equal Time.local(2006, 8, 22), span.end
29
+
30
+ span = mondays.next(:future)
31
+
32
+ assert_equal Time.local(2006, 8, 28), span.begin
33
+ assert_equal Time.local(2006, 8, 29), span.end
34
+ end
35
+
36
+ def test_next_past
37
+ mondays = Chronic::RepeaterDayName.new(:monday)
38
+ mondays.start = @now
39
+
40
+ span = mondays.next(:past)
41
+
42
+ assert_equal Time.local(2006, 8, 14), span.begin
43
+ assert_equal Time.local(2006, 8, 15), span.end
44
+
45
+ span = mondays.next(:past)
46
+
47
+ assert_equal Time.local(2006, 8, 7), span.begin
48
+ assert_equal Time.local(2006, 8, 8), span.end
49
+ end
50
+
51
+ end
@@ -0,0 +1,254 @@
1
+ require 'helper'
2
+
3
+ class TestRepeaterDayPortion < TestCase
4
+
5
+ def setup
6
+ @now = Time.local(2006, 8, 16, 14, 0, 0, 0)
7
+ end
8
+
9
+ def test_am_future
10
+ day_portion = Chronic::RepeaterDayPortion.new(:am)
11
+ day_portion.start = @now
12
+
13
+ next_time = day_portion.next(:future)
14
+ assert_equal Time.local(2006, 8, 17, 00), next_time.begin
15
+ assert_equal Time.local(2006, 8, 17, 11, 59, 59), next_time.end
16
+
17
+ next_next_time = day_portion.next(:future)
18
+ assert_equal Time.local(2006, 8, 18, 00), next_next_time.begin
19
+ assert_equal Time.local(2006, 8, 18, 11, 59, 59), next_next_time.end
20
+ end
21
+
22
+ def test_am_past
23
+ day_portion = Chronic::RepeaterDayPortion.new(:am)
24
+ day_portion.start = @now
25
+
26
+ next_time = day_portion.next(:past)
27
+ assert_equal Time.local(2006, 8, 16, 00), next_time.begin
28
+ assert_equal Time.local(2006, 8, 16, 11, 59, 59), next_time.end
29
+
30
+ next_next_time = day_portion.next(:past)
31
+ assert_equal Time.local(2006, 8, 15, 00), next_next_time.begin
32
+ assert_equal Time.local(2006, 8, 15, 11, 59, 59), next_next_time.end
33
+ end
34
+
35
+ def test_am_future_with_daylight_savings_time_boundary
36
+ @now = Time.local(2012,11,3,0,0,0)
37
+ day_portion = Chronic::RepeaterDayPortion.new(:am)
38
+ day_portion.start = @now
39
+
40
+ next_time = day_portion.next(:future)
41
+ assert_equal Time.local(2012, 11, 4, 00), next_time.begin
42
+ assert_equal Time.local(2012, 11, 4, 11, 59, 59), next_time.end
43
+
44
+ next_next_time = day_portion.next(:future)
45
+
46
+ assert_equal Time.local(2012, 11, 5, 00), next_next_time.begin
47
+ assert_equal Time.local(2012, 11, 5, 11, 59, 59), next_next_time.end
48
+ end
49
+
50
+ def test_pm_future
51
+ day_portion = Chronic::RepeaterDayPortion.new(:pm)
52
+ day_portion.start = @now
53
+
54
+ next_time = day_portion.next(:future)
55
+ assert_equal Time.local(2006, 8, 17, 12), next_time.begin
56
+ assert_equal Time.local(2006, 8, 17, 23, 59, 59), next_time.end
57
+
58
+ next_next_time = day_portion.next(:future)
59
+ assert_equal Time.local(2006, 8, 18, 12), next_next_time.begin
60
+ assert_equal Time.local(2006, 8, 18, 23, 59, 59), next_next_time.end
61
+ end
62
+
63
+ def test_pm_past
64
+ day_portion = Chronic::RepeaterDayPortion.new(:pm)
65
+ day_portion.start = @now
66
+
67
+ next_time = day_portion.next(:past)
68
+ assert_equal Time.local(2006, 8, 15, 12), next_time.begin
69
+ assert_equal Time.local(2006, 8, 15, 23, 59, 59), next_time.end
70
+
71
+ next_next_time = day_portion.next(:past)
72
+ assert_equal Time.local(2006, 8, 14, 12), next_next_time.begin
73
+ assert_equal Time.local(2006, 8, 14, 23, 59, 59), next_next_time.end
74
+ end
75
+
76
+ def test_pm_future_with_daylight_savings_time_boundary
77
+ @now = Time.local(2012,11,3,0,0,0)
78
+ day_portion = Chronic::RepeaterDayPortion.new(:pm)
79
+ day_portion.start = @now
80
+
81
+ next_time = day_portion.next(:future)
82
+ assert_equal Time.local(2012, 11, 3, 12), next_time.begin
83
+ assert_equal Time.local(2012, 11, 3, 23, 59, 59), next_time.end
84
+
85
+ next_next_time = day_portion.next(:future)
86
+
87
+ assert_equal Time.local(2012, 11, 4, 12), next_next_time.begin
88
+ assert_equal Time.local(2012, 11, 4, 23, 59, 59), next_next_time.end
89
+ end
90
+
91
+ def test_morning_future
92
+ day_portion = Chronic::RepeaterDayPortion.new(:morning)
93
+ day_portion.start = @now
94
+
95
+ next_time = day_portion.next(:future)
96
+ assert_equal Time.local(2006, 8, 17, 6), next_time.begin
97
+ assert_equal Time.local(2006, 8, 17, 12), next_time.end
98
+
99
+ next_next_time = day_portion.next(:future)
100
+ assert_equal Time.local(2006, 8, 18, 6), next_next_time.begin
101
+ assert_equal Time.local(2006, 8, 18, 12), next_next_time.end
102
+ end
103
+
104
+ def test_morning_past
105
+ day_portion = Chronic::RepeaterDayPortion.new(:morning)
106
+ day_portion.start = @now
107
+
108
+ next_time = day_portion.next(:past)
109
+ assert_equal Time.local(2006, 8, 16, 6), next_time.begin
110
+ assert_equal Time.local(2006, 8, 16, 12), next_time.end
111
+
112
+ next_next_time = day_portion.next(:past)
113
+ assert_equal Time.local(2006, 8, 15, 6), next_next_time.begin
114
+ assert_equal Time.local(2006, 8, 15, 12), next_next_time.end
115
+ end
116
+
117
+ def test_morning_future_with_daylight_savings_time_boundary
118
+ @now = Time.local(2012,11,3,0,0,0)
119
+ day_portion = Chronic::RepeaterDayPortion.new(:morning)
120
+ day_portion.start = @now
121
+
122
+ next_time = day_portion.next(:future)
123
+ assert_equal Time.local(2012, 11, 3, 6), next_time.begin
124
+ assert_equal Time.local(2012, 11, 3, 12), next_time.end
125
+
126
+ next_next_time = day_portion.next(:future)
127
+
128
+ assert_equal Time.local(2012, 11, 4, 6), next_next_time.begin
129
+ assert_equal Time.local(2012, 11, 4, 12), next_next_time.end
130
+ end
131
+
132
+ def test_afternoon_future
133
+ day_portion = Chronic::RepeaterDayPortion.new(:afternoon)
134
+ day_portion.start = @now
135
+
136
+ next_time = day_portion.next(:future)
137
+ assert_equal Time.local(2006, 8, 17, 13), next_time.begin
138
+ assert_equal Time.local(2006, 8, 17, 17), next_time.end
139
+
140
+ next_next_time = day_portion.next(:future)
141
+ assert_equal Time.local(2006, 8, 18, 13), next_next_time.begin
142
+ assert_equal Time.local(2006, 8, 18, 17), next_next_time.end
143
+ end
144
+
145
+ def test_afternoon_past
146
+ day_portion = Chronic::RepeaterDayPortion.new(:afternoon)
147
+ day_portion.start = @now
148
+
149
+ next_time = day_portion.next(:past)
150
+ assert_equal Time.local(2006, 8, 15, 13), next_time.begin
151
+ assert_equal Time.local(2006, 8, 15, 17), next_time.end
152
+
153
+ next_next_time = day_portion.next(:past)
154
+ assert_equal Time.local(2006, 8, 14, 13), next_next_time.begin
155
+ assert_equal Time.local(2006, 8, 14, 17), next_next_time.end
156
+ end
157
+
158
+ def test_afternoon_future_with_daylight_savings_time_boundary
159
+ @now = Time.local(2012,11,3,0,0,0)
160
+ day_portion = Chronic::RepeaterDayPortion.new(:afternoon)
161
+ day_portion.start = @now
162
+
163
+ next_time = day_portion.next(:future)
164
+ assert_equal Time.local(2012, 11, 3, 13), next_time.begin
165
+ assert_equal Time.local(2012, 11, 3, 17), next_time.end
166
+
167
+ next_next_time = day_portion.next(:future)
168
+
169
+ assert_equal Time.local(2012, 11, 4, 13), next_next_time.begin
170
+ assert_equal Time.local(2012, 11, 4, 17), next_next_time.end
171
+ end
172
+
173
+ def test_evening_future
174
+ day_portion = Chronic::RepeaterDayPortion.new(:evening)
175
+ day_portion.start = @now
176
+
177
+ next_time = day_portion.next(:future)
178
+ assert_equal Time.local(2006, 8, 16, 17), next_time.begin
179
+ assert_equal Time.local(2006, 8, 16, 20), next_time.end
180
+
181
+ next_next_time = day_portion.next(:future)
182
+ assert_equal Time.local(2006, 8, 17, 17), next_next_time.begin
183
+ assert_equal Time.local(2006, 8, 17, 20), next_next_time.end
184
+ end
185
+
186
+ def test_evening_past
187
+ day_portion = Chronic::RepeaterDayPortion.new(:evening)
188
+ day_portion.start = @now
189
+
190
+ next_time = day_portion.next(:past)
191
+ assert_equal Time.local(2006, 8, 15, 17), next_time.begin
192
+ assert_equal Time.local(2006, 8, 15, 20), next_time.end
193
+
194
+ next_next_time = day_portion.next(:past)
195
+ assert_equal Time.local(2006, 8, 14, 17), next_next_time.begin
196
+ assert_equal Time.local(2006, 8, 14, 20), next_next_time.end
197
+ end
198
+
199
+ def test_evening_future_with_daylight_savings_time_boundary
200
+ @now = Time.local(2012,11,3,0,0,0)
201
+ day_portion = Chronic::RepeaterDayPortion.new(:evening)
202
+ day_portion.start = @now
203
+
204
+ next_time = day_portion.next(:future)
205
+ assert_equal Time.local(2012, 11, 3, 17), next_time.begin
206
+ assert_equal Time.local(2012, 11, 3, 20), next_time.end
207
+
208
+ next_next_time = day_portion.next(:future)
209
+
210
+ assert_equal Time.local(2012, 11, 4, 17), next_next_time.begin
211
+ assert_equal Time.local(2012, 11, 4, 20), next_next_time.end
212
+ end
213
+
214
+ def test_night_future
215
+ day_portion = Chronic::RepeaterDayPortion.new(:night)
216
+ day_portion.start = @now
217
+
218
+ next_time = day_portion.next(:future)
219
+ assert_equal Time.local(2006, 8, 16, 20), next_time.begin
220
+ assert_equal Time.local(2006, 8, 17, 0), next_time.end
221
+
222
+ next_next_time = day_portion.next(:future)
223
+ assert_equal Time.local(2006, 8, 17, 20), next_next_time.begin
224
+ assert_equal Time.local(2006, 8, 18, 0), next_next_time.end
225
+ end
226
+
227
+ def test_night_past
228
+ day_portion = Chronic::RepeaterDayPortion.new(:night)
229
+ day_portion.start = @now
230
+
231
+ next_time = day_portion.next(:past)
232
+ assert_equal Time.local(2006, 8, 15, 20), next_time.begin
233
+ assert_equal Time.local(2006, 8, 16, 0), next_time.end
234
+
235
+ next_next_time = day_portion.next(:past)
236
+ assert_equal Time.local(2006, 8, 14, 20), next_next_time.begin
237
+ assert_equal Time.local(2006, 8, 15, 0), next_next_time.end
238
+ end
239
+
240
+ def test_night_future_with_daylight_savings_time_boundary
241
+ @now = Time.local(2012,11,3,0,0,0)
242
+ day_portion = Chronic::RepeaterDayPortion.new(:night)
243
+ day_portion.start = @now
244
+
245
+ next_time = day_portion.next(:future)
246
+ assert_equal Time.local(2012, 11, 3, 20), next_time.begin
247
+ assert_equal Time.local(2012, 11, 4, 0), next_time.end
248
+
249
+ next_next_time = day_portion.next(:future)
250
+
251
+ assert_equal Time.local(2012, 11, 4, 20), next_next_time.begin
252
+ assert_equal Time.local(2012, 11, 5, 0), next_next_time.end
253
+ end
254
+ end
@@ -0,0 +1,62 @@
1
+ require 'helper'
2
+
3
+ class TestRepeaterFortnight < TestCase
4
+
5
+ def setup
6
+ @now = Time.local(2006, 8, 16, 14, 0, 0, 0)
7
+ end
8
+
9
+ def test_next_future
10
+ fortnights = Chronic::RepeaterFortnight.new(:fortnight)
11
+ fortnights.start = @now
12
+
13
+ next_fortnight = fortnights.next(:future)
14
+ assert_equal Time.local(2006, 8, 20), next_fortnight.begin
15
+ assert_equal Time.local(2006, 9, 3), next_fortnight.end
16
+
17
+ next_next_fortnight = fortnights.next(:future)
18
+ assert_equal Time.local(2006, 9, 3), next_next_fortnight.begin
19
+ assert_equal Time.local(2006, 9, 17), next_next_fortnight.end
20
+ end
21
+
22
+ def test_next_past
23
+ fortnights = Chronic::RepeaterFortnight.new(:fortnight)
24
+ fortnights.start = @now
25
+
26
+ last_fortnight = fortnights.next(:past)
27
+ assert_equal Time.local(2006, 7, 30), last_fortnight.begin
28
+ assert_equal Time.local(2006, 8, 13), last_fortnight.end
29
+
30
+ last_last_fortnight = fortnights.next(:past)
31
+ assert_equal Time.local(2006, 7, 16), last_last_fortnight.begin
32
+ assert_equal Time.local(2006, 7, 30), last_last_fortnight.end
33
+ end
34
+
35
+ def test_this_future
36
+ fortnights = Chronic::RepeaterFortnight.new(:fortnight)
37
+ fortnights.start = @now
38
+
39
+ this_fortnight = fortnights.this(:future)
40
+ assert_equal Time.local(2006, 8, 16, 15), this_fortnight.begin
41
+ assert_equal Time.local(2006, 8, 27), this_fortnight.end
42
+ end
43
+
44
+ def test_this_past
45
+ fortnights = Chronic::RepeaterFortnight.new(:fortnight)
46
+ fortnights.start = @now
47
+
48
+ this_fortnight = fortnights.this(:past)
49
+ assert_equal Time.local(2006, 8, 13, 0), this_fortnight.begin
50
+ assert_equal Time.local(2006, 8, 16, 14), this_fortnight.end
51
+ end
52
+
53
+ def test_offset
54
+ span = Chronic::Span.new(@now, @now + 1)
55
+
56
+ offset_span = Chronic::RepeaterWeek.new(:week).offset(span, 3, :future)
57
+
58
+ assert_equal Time.local(2006, 9, 6, 14), offset_span.begin
59
+ assert_equal Time.local(2006, 9, 6, 14, 0, 1), offset_span.end
60
+ end
61
+
62
+ end
@@ -0,0 +1,68 @@
1
+ require 'helper'
2
+
3
+ class TestRepeaterHour < TestCase
4
+
5
+ def setup
6
+ @now = Time.local(2006, 8, 16, 14, 0, 0, 0)
7
+ end
8
+
9
+ def test_next_future
10
+ hours = Chronic::RepeaterHour.new(:hour)
11
+ hours.start = @now
12
+
13
+ next_hour = hours.next(:future)
14
+ assert_equal Time.local(2006, 8, 16, 15), next_hour.begin
15
+ assert_equal Time.local(2006, 8, 16, 16), next_hour.end
16
+
17
+ next_next_hour = hours.next(:future)
18
+ assert_equal Time.local(2006, 8, 16, 16), next_next_hour.begin
19
+ assert_equal Time.local(2006, 8, 16, 17), next_next_hour.end
20
+ end
21
+
22
+ def test_next_past
23
+ hours = Chronic::RepeaterHour.new(:hour)
24
+ hours.start = @now
25
+
26
+ past_hour = hours.next(:past)
27
+ assert_equal Time.local(2006, 8, 16, 13), past_hour.begin
28
+ assert_equal Time.local(2006, 8, 16, 14), past_hour.end
29
+
30
+ past_past_hour = hours.next(:past)
31
+ assert_equal Time.local(2006, 8, 16, 12), past_past_hour.begin
32
+ assert_equal Time.local(2006, 8, 16, 13), past_past_hour.end
33
+ end
34
+
35
+ def test_this
36
+ @now = Time.local(2006, 8, 16, 14, 30)
37
+
38
+ hours = Chronic::RepeaterHour.new(:hour)
39
+ hours.start = @now
40
+
41
+ this_hour = hours.this(:future)
42
+ assert_equal Time.local(2006, 8, 16, 14, 31), this_hour.begin
43
+ assert_equal Time.local(2006, 8, 16, 15), this_hour.end
44
+
45
+ this_hour = hours.this(:past)
46
+ assert_equal Time.local(2006, 8, 16, 14), this_hour.begin
47
+ assert_equal Time.local(2006, 8, 16, 14, 30), this_hour.end
48
+
49
+ this_hour = hours.this(:none)
50
+ assert_equal Time.local(2006, 8, 16, 14), this_hour.begin
51
+ assert_equal Time.local(2006, 8, 16, 15), this_hour.end
52
+ end
53
+
54
+ def test_offset
55
+ span = Chronic::Span.new(@now, @now + 1)
56
+
57
+ offset_span = Chronic::RepeaterHour.new(:hour).offset(span, 3, :future)
58
+
59
+ assert_equal Time.local(2006, 8, 16, 17), offset_span.begin
60
+ assert_equal Time.local(2006, 8, 16, 17, 0, 1), offset_span.end
61
+
62
+ offset_span = Chronic::RepeaterHour.new(:hour).offset(span, 24, :past)
63
+
64
+ assert_equal Time.local(2006, 8, 15, 14), offset_span.begin
65
+ assert_equal Time.local(2006, 8, 15, 14, 0, 1), offset_span.end
66
+ end
67
+
68
+ end
@@ -0,0 +1,34 @@
1
+ require 'helper'
2
+
3
+ class TestRepeaterMinute < TestCase
4
+
5
+ def setup
6
+ @now = Time.local(2008, 6, 25, 7, 15, 30, 0)
7
+ end
8
+
9
+ def test_next_future
10
+ minutes = Chronic::RepeaterMinute.new(:minute)
11
+ minutes.start = @now
12
+
13
+ next_minute = minutes.next(:future)
14
+ assert_equal Time.local(2008, 6, 25, 7, 16), next_minute.begin
15
+ assert_equal Time.local(2008, 6, 25, 7, 17), next_minute.end
16
+
17
+ next_next_minute = minutes.next(:future)
18
+ assert_equal Time.local(2008, 6, 25, 7, 17), next_next_minute.begin
19
+ assert_equal Time.local(2008, 6, 25, 7, 18), next_next_minute.end
20
+ end
21
+
22
+ def test_next_past
23
+ minutes = Chronic::RepeaterMinute.new(:minute)
24
+ minutes.start = @now
25
+
26
+ prev_minute = minutes.next(:past)
27
+ assert_equal Time.local(2008, 6, 25, 7, 14), prev_minute.begin
28
+ assert_equal Time.local(2008, 6, 25, 7, 15), prev_minute.end
29
+
30
+ prev_prev_minute = minutes.next(:past)
31
+ assert_equal Time.local(2008, 6, 25, 7, 13), prev_prev_minute.begin
32
+ assert_equal Time.local(2008, 6, 25, 7, 14), prev_prev_minute.end
33
+ end
34
+ end