cronex 0.7.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +24 -15
- data/.travis.yml +7 -1
- data/CHANGELOG.md +15 -0
- data/README.md +10 -1
- data/cronex.gemspec +2 -1
- data/lib/cronex/description/hours.rb +2 -2
- data/lib/cronex/exp_descriptor.rb +11 -8
- data/lib/cronex/utils.rb +8 -10
- data/lib/cronex/version.rb +1 -1
- data/resources/resources_de.yml +75 -0
- data/resources/resources_it.yml +75 -0
- data/spec/exp_descriptor_de_spec.rb +383 -0
- data/spec/exp_descriptor_en_spec.rb +23 -2
- data/spec/exp_descriptor_fr_spec.rb +3 -2
- data/spec/exp_descriptor_it_spec.rb +383 -0
- data/spec/exp_descriptor_pt_BR_spec.rb +3 -2
- data/spec/exp_descriptor_ro_spec.rb +3 -2
- data/spec/exp_descriptor_ru_spec.rb +3 -2
- metadata +26 -6
@@ -5,7 +5,8 @@ module Cronex
|
|
5
5
|
describe ExpressionDescriptor do
|
6
6
|
|
7
7
|
def desc(expression, opts = {})
|
8
|
-
|
8
|
+
opts[:locale] = 'en'
|
9
|
+
Cronex::ExpressionDescriptor.new(expression, opts).description
|
9
10
|
end
|
10
11
|
|
11
12
|
let(:opts) { { zero_based_dow: false } }
|
@@ -375,7 +376,27 @@ module Cronex
|
|
375
376
|
end
|
376
377
|
|
377
378
|
it 'year increments' do
|
378
|
-
expect(desc('0 0 0 1 MAR * 2010/5')).to eq('At
|
379
|
+
expect(desc('0 0 0 1 MAR * 2010/5')).to eq('At 12:00 AM, on day 1 of the month, only in March, every 5 years, starting in 2010')
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
context 'timezone' do
|
384
|
+
it 'minute span' do
|
385
|
+
tz = TZInfo::Timezone.get('America/Los_Angeles')
|
386
|
+
hour = tz.period_for_local(Time.now).zone_identifier.to_s == 'PDT' ? 4 : 3
|
387
|
+
expect(desc('0-10 11 * * *', timezone: 'America/Los_Angeles')).to eq("Every minute between #{hour}:00 AM and #{hour}:10 AM")
|
388
|
+
end
|
389
|
+
|
390
|
+
it 'twice a day' do
|
391
|
+
tz = TZInfo::Timezone.get('America/Los_Angeles')
|
392
|
+
hour = tz.period_for_local(Time.now).zone_identifier.to_s == 'PDT' ? 5 : 4
|
393
|
+
expect(desc('0 0,12 * * *', timezone: 'America/Los_Angeles')).to eq("At #{hour}:00 PM and #{hour}:00 AM")
|
394
|
+
end
|
395
|
+
|
396
|
+
it 'ahead of GMT' do
|
397
|
+
tz = TZInfo::Timezone.get('Europe/Vienna')
|
398
|
+
hour = tz.period_for_local(Time.now).zone_identifier.to_s == 'CEST' ? 1 : 12
|
399
|
+
expect(desc('0-10 11 * * *', timezone: 'Europe/Vienna')).to eq("Every minute between #{hour}:00 PM and #{hour}:10 PM")
|
379
400
|
end
|
380
401
|
end
|
381
402
|
end
|
@@ -5,7 +5,8 @@ module Cronex
|
|
5
5
|
describe ExpressionDescriptor do
|
6
6
|
|
7
7
|
def desc(expression, opts = {})
|
8
|
-
|
8
|
+
opts[:locale] = 'fr'
|
9
|
+
Cronex::ExpressionDescriptor.new(expression, opts).description
|
9
10
|
end
|
10
11
|
|
11
12
|
let(:opts) { { zero_based_dow: false } }
|
@@ -375,7 +376,7 @@ module Cronex
|
|
375
376
|
end
|
376
377
|
|
377
378
|
it 'year increments' do
|
378
|
-
expect(desc('0 0 0 1 MAR * 2010/5')).to eq('À
|
379
|
+
expect(desc('0 0 0 1 MAR * 2010/5')).to eq('À 12:00 AM, le 1 de chaque mois, seulement en mars, tous les 5 ans, commence en 2010')
|
379
380
|
end
|
380
381
|
end
|
381
382
|
end
|
@@ -0,0 +1,383 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'cronex'
|
3
|
+
|
4
|
+
module Cronex
|
5
|
+
describe ExpressionDescriptor do
|
6
|
+
|
7
|
+
def desc(expression, opts = {})
|
8
|
+
opts[:locale] = 'it'
|
9
|
+
Cronex::ExpressionDescriptor.new(expression, opts).description
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:opts) { { zero_based_dow: false } }
|
13
|
+
|
14
|
+
it 'every second' do
|
15
|
+
expect(desc('* * * * * *')).to eq('Ogni secondo')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'every 45 seconds' do
|
19
|
+
expect(desc('*/45 * * * * *')).to eq('Ogni 45 secondi')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'minute span' do
|
23
|
+
expect(desc('0-10 11 * * *')).to eq('Ogni minuto tra le 11:00 AM e le 11:10 AM')
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'every minute' do
|
27
|
+
it 'every minute' do
|
28
|
+
expect(desc('* * * * *')).to eq('Ogni minuto')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'every minute */1' do
|
32
|
+
expect(desc('*/1 * * * *')).to eq('Ogni minuto')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'every minute 0 0/1' do
|
36
|
+
expect(desc('0 0/1 * * * ?')).to eq('Ogni minuto')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context 'every X minutes:' do
|
41
|
+
it 'every 5 minuti' do
|
42
|
+
expect(desc('*/5 * * * *')).to eq('Ogni 5 minuti')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'every 5 minute 0 */5' do
|
46
|
+
expect(desc('0 */5 * * * *')).to eq('Ogni 5 minuti')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'every 10 minutes 0 0/10' do
|
50
|
+
expect(desc('0 0/10 * * * ?')).to eq('Ogni 10 minuti')
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context 'every hour:' do
|
55
|
+
it 'every hour 0 0' do
|
56
|
+
expect(desc('0 0 * * * ?')).to eq('Ogni ora')
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'every hour 0 0 0/1' do
|
60
|
+
expect(desc('0 0 0/1 * * ?')).to eq('Ogni ora')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'daily:' do
|
65
|
+
it 'daily at /\d\d/:/\d\d/' do
|
66
|
+
expect(desc('30 11 * * *')).to eq('Alle(ai) 11:30 AM')
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'daily at /\d/:/\d/' do
|
70
|
+
expect(desc('9 8 * * *')).to eq('Alle(ai) 8:09 AM')
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'daily at /0[89]/:/0[89]/' do
|
74
|
+
expect(desc('09 08 * * *')).to eq('Alle(ai) 8:09 AM')
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'daily at /0[1-7]/ /0[1-7/' do
|
78
|
+
expect(desc('02 01 * * *')).to eq('Alle(ai) 1:02 AM')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'time of day certain days of week:' do
|
83
|
+
it 'time of day on MON-FRI' do
|
84
|
+
expect(desc('0 23 ? * MON-FRI')).to eq('Alle(ai) 11:00 PM, da lunedì a venerdì')
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'time of day on 1-5' do
|
88
|
+
expect(desc('30 11 * * 1-5')).to eq('Alle(ai) 11:30 AM, da lunedì a venerdì')
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'one month only' do
|
93
|
+
expect(desc('* * * 3 *')).to eq('Ogni minuto, solo a(nel) marzo')
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'two months only' do
|
97
|
+
expect(desc('* * * 3,6 *')).to eq('Ogni minuto, solo a(nel) marzo e giugno')
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'two times each afternoon' do
|
101
|
+
expect(desc('30 14,16 * * *')).to eq('Alle(ai) 2:30 PM e 4:30 PM')
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'three times daily' do
|
105
|
+
expect(desc('30 6,14,16 * * *')).to eq('Alle(ai) 6:30 AM, 2:30 PM e 4:30 PM')
|
106
|
+
end
|
107
|
+
|
108
|
+
context 'once a week:' do
|
109
|
+
it 'once a week 0' do
|
110
|
+
expect(desc('46 9 * * 0')).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'once a week SUN' do
|
114
|
+
expect(desc('46 9 * * SUN')).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
115
|
+
end
|
116
|
+
|
117
|
+
it 'once a week 7' do
|
118
|
+
expect(desc('46 9 * * 7')).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'once a week 1' do
|
122
|
+
expect(desc('46 9 * * 1')).to eq('Alle(ai) 9:46 AM, solo di lunedì')
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'once a week 6' do
|
126
|
+
expect(desc('46 9 * * 6')).to eq('Alle(ai) 9:46 AM, solo di sabato')
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
context 'once a week non zero based:' do
|
131
|
+
it 'once a week 1' do
|
132
|
+
expect(desc('46 9 * * 1', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'once a week SUN' do
|
136
|
+
expect(desc('46 9 * * SUN', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica')
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'once a week 2' do
|
140
|
+
expect(desc('46 9 * * 2', opts)).to eq('Alle(ai) 9:46 AM, solo di lunedì')
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'once a week 7' do
|
144
|
+
expect(desc('46 9 * * 7', opts)).to eq('Alle(ai) 9:46 AM, solo di sabato')
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'twice a week:' do
|
149
|
+
it 'twice a week 1,2' do
|
150
|
+
expect(desc('46 9 * * 1,2')).to eq('Alle(ai) 9:46 AM, solo di lunedì e martedì')
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'twice a week MON,TUE' do
|
154
|
+
expect(desc('46 9 * * MON,TUE')).to eq('Alle(ai) 9:46 AM, solo di lunedì e martedì')
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'twice a week 0,6' do
|
158
|
+
expect(desc('46 9 * * 0,6')).to eq('Alle(ai) 9:46 AM, solo di domenica e sabato')
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'twice a week 6,7' do
|
162
|
+
expect(desc('46 9 * * 6,7')).to eq('Alle(ai) 9:46 AM, solo di sabato e domenica')
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
context 'twice a week non zero based:' do
|
167
|
+
it 'twice a week 1,2' do
|
168
|
+
expect(desc('46 9 * * 1,2', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica e lunedì')
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'twice a week SUN,MON' do
|
172
|
+
expect(desc('46 9 * * SUN,MON', opts)).to eq('Alle(ai) 9:46 AM, solo di domenica e lunedì')
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'twice a week 6,7' do
|
176
|
+
expect(desc('46 9 * * 6,7', opts)).to eq('Alle(ai) 9:46 AM, solo di venerdì e sabato')
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'day of month' do
|
181
|
+
expect(desc('23 12 15 * *')).to eq('Alle(ai) 12:23 PM, il giorno 15 del mese')
|
182
|
+
end
|
183
|
+
|
184
|
+
it 'day of month with day of week' do
|
185
|
+
expect(desc('23 12 15 * SUN')).to eq('Alle(ai) 12:23 PM, il giorno 15 del mese, solo di domenica')
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'month name' do
|
189
|
+
expect(desc('23 12 * JAN *')).to eq('Alle(ai) 12:23 PM, solo a(nel) gennaio')
|
190
|
+
end
|
191
|
+
|
192
|
+
it 'day of month with question mark' do
|
193
|
+
expect(desc('23 12 ? JAN *')).to eq('Alle(ai) 12:23 PM, solo a(nel) gennaio')
|
194
|
+
end
|
195
|
+
|
196
|
+
it 'month name range 2' do
|
197
|
+
expect(desc('23 12 * JAN-FEB *')).to eq('Alle(ai) 12:23 PM, da gennaio a febbraio')
|
198
|
+
end
|
199
|
+
|
200
|
+
it 'month name range 3' do
|
201
|
+
expect(desc('23 12 * JAN-MAR *')).to eq('Alle(ai) 12:23 PM, da gennaio a marzo')
|
202
|
+
end
|
203
|
+
|
204
|
+
it 'day of week name' do
|
205
|
+
expect(desc('23 12 * * SUN')).to eq('Alle(ai) 12:23 PM, solo di domenica')
|
206
|
+
end
|
207
|
+
|
208
|
+
context 'day of week range:' do
|
209
|
+
it 'day of week range MON-FRI' do
|
210
|
+
expect(desc('*/5 15 * * MON-FRI')).to eq('Ogni 5 minuti, alle(ai) 3:00 PM, da lunedì a venerdì')
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'day of week range 0-6' do
|
214
|
+
expect(desc('*/5 15 * * 0-6')).to eq('Ogni 5 minuti, alle(ai) 3:00 PM, da domenica a sabato')
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'day of week range 6-7' do
|
218
|
+
expect(desc('*/5 15 * * 6-7')).to eq('Ogni 5 minuti, alle(ai) 3:00 PM, da sabato a domenica')
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
context 'day of week once in month:' do
|
223
|
+
it 'day of week once MON#3' do
|
224
|
+
expect(desc('* * * * MON#3')).to eq('Ogni minuto, il(la) terzo(a) lunedì del mese')
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'day of week once 0#3' do
|
228
|
+
expect(desc('* * * * 0#3')).to eq('Ogni minuto, il(la) terzo(a) domenica del mese')
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
context 'last day of week del mese:' do
|
233
|
+
it 'last day of week 4L' do
|
234
|
+
expect(desc('* * * * 4L')).to eq('Ogni minuto, l\'ultimo(a) giovedì del mese')
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'last day of week 0L' do
|
238
|
+
expect(desc('* * * * 0L')).to eq('Ogni minuto, l\'ultimo(a) domenica del mese')
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
it 'last day of the month' do
|
243
|
+
expect(desc('*/5 * L JAN *')).to eq('Ogni 5 minuti, l\'ultimo giorno del mese, solo a(nel) gennaio')
|
244
|
+
end
|
245
|
+
|
246
|
+
it 'time of day with seconds' do
|
247
|
+
expect(desc('30 02 14 * * *')).to eq('Alle(ai) 2:02:30 PM')
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'second intervals' do
|
251
|
+
expect(desc('5-10 * * * * *')).to eq('Dal secondo 5 al 10 dopo il minuto')
|
252
|
+
end
|
253
|
+
|
254
|
+
it 'second minutes hours intervals' do
|
255
|
+
expect(desc('5-10 30-35 10-12 * * *')).to eq(
|
256
|
+
'Dal secondo 5 al 10 dopo il minuto, dal minuto 30 al 35 dopo l\'ora, tra le 10:00 AM e le 12:59 PM')
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'every 5 minutes at 30 seconds' do
|
260
|
+
expect(desc('30 */5 * * * *')).to eq('A 30 secondi dopo il minuto, ogni 5 minuti')
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'minutes past the hour range' do
|
264
|
+
expect(desc('0 30 10-13 ? * WED,FRI')).to eq(
|
265
|
+
'Alle(ai) 30 minuti dopo l\'ora, tra le 10:00 AM e le 1:59 PM, solo di mercoledì e venerdì')
|
266
|
+
end
|
267
|
+
|
268
|
+
it 'seconds past the minute interval' do
|
269
|
+
expect(desc('10 0/5 * * * ?')).to eq('A 10 secondi dopo il minuto, ogni 5 minuti')
|
270
|
+
end
|
271
|
+
|
272
|
+
it 'between with interval' do
|
273
|
+
expect(desc('2-59/3 1,9,22 11-26 1-6 ?')).to eq(
|
274
|
+
'Ogni 3 minuti, dal minuto 02 al 59 dopo l\'ora, alle(ai) 1:00 AM, 9:00 AM e 10:00 PM, tra il giorno 11 e il giorno 26 del mese, da gennaio a giugno')
|
275
|
+
end
|
276
|
+
|
277
|
+
it 'recurring first of month' do
|
278
|
+
expect(desc('0 0 6 1/1 * ?')).to eq('Alle(ai) 6:00 AM')
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'minutes past the hour' do
|
282
|
+
expect(desc('0 5 0/1 * * ?')).to eq('Alle(ai) 05 minuti dopo l\'ora')
|
283
|
+
end
|
284
|
+
|
285
|
+
it 'every past the hour' do
|
286
|
+
expect(desc('0 0,5,10,15,20,25,30,35,40,45,50,55 * ? * *')).to eq(
|
287
|
+
'Alle(ai) 00, 05, 10, 15, 20, 25, 30, 35, 40, 45, 50 e 55 minuti dopo l\'ora')
|
288
|
+
end
|
289
|
+
|
290
|
+
it 'every x minute past the hour with interval' do
|
291
|
+
expect(desc('0 0-30/2 17 ? * MON-FRI')).to eq(
|
292
|
+
'Ogni 2 minuti, dal minuto 00 al 30 dopo l\'ora, alle(ai) 5:00 PM, da lunedì a venerdì')
|
293
|
+
end
|
294
|
+
|
295
|
+
it 'one year only with seconds' do
|
296
|
+
expect(desc('* * * * * * 2013')).to eq('Ogni secondo, solo a(nel) 2013')
|
297
|
+
end
|
298
|
+
|
299
|
+
it 'one year only without seconds' do
|
300
|
+
expect(desc('* * * * * 2013')).to eq('Ogni minuto, solo a(nel) 2013')
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'two years only' do
|
304
|
+
expect(desc('* * * * * 2013,2014')).to eq('Ogni minuto, solo a(nel) 2013 e 2014')
|
305
|
+
end
|
306
|
+
|
307
|
+
it 'year range 2' do
|
308
|
+
expect(desc('23 12 * JAN-FEB * 2013-2014')).to eq('Alle(ai) 12:23 PM, da gennaio a febbraio, da 2013 a 2014')
|
309
|
+
end
|
310
|
+
|
311
|
+
it 'year range 3' do
|
312
|
+
expect(desc('23 12 * JAN-MAR * 2013-2015')).to eq('Alle(ai) 12:23 PM, da gennaio a marzo, da 2013 a 2015')
|
313
|
+
end
|
314
|
+
|
315
|
+
context 'multi part range seconds:' do
|
316
|
+
it 'multi part range seconds 2,4-5' do
|
317
|
+
expect(desc('2,4-5 1 * * *')).to eq('Dal minuto 02,04 al 05 dopo l\'ora, alle(ai) 1:00 AM')
|
318
|
+
end
|
319
|
+
|
320
|
+
it 'multi part range seconds 2,26-28' do
|
321
|
+
expect(desc('2,26-28 18 * * *')).to eq('Dal minuto 02,26 al 28 dopo l\'ora, alle(ai) 6:00 PM')
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
context 'minutes past the hour:' do
|
326
|
+
it 'minutes past the hour 5,10' do
|
327
|
+
expect(desc('5,10 0 * * *')).to eq('Alle(ai) 05 e 10 minuti dopo l\'ora')
|
328
|
+
end
|
329
|
+
|
330
|
+
it 'minutes past the hour 5,10 day 2' do
|
331
|
+
expect(desc('5,10 0 2 * *')).to eq('Alle(ai) 05 e 10 minuti dopo l\'ora, il giorno 2 del mese')
|
332
|
+
end
|
333
|
+
|
334
|
+
it 'minutes past the hour 5/10 day 2' do
|
335
|
+
expect(desc('5/10 0 2 * *')).to eq('Ogni 10 minuti, a partire da alle(ai) 05 minuti dopo l\'ora, il giorno 2 del mese')
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
context 'seconds past the minute:' do
|
340
|
+
it 'seconds past the minute 5,6' do
|
341
|
+
expect(desc('5,6 0 0 * * *')).to eq('A 5 e 6 secondi dopo il minuto')
|
342
|
+
end
|
343
|
+
|
344
|
+
it 'seconds past the minute 5,6 at 1' do
|
345
|
+
expect(desc('5,6 0 1 * * *')).to eq('A 5 e 6 secondi dopo il minuto, alle(ai) 1:00 AM')
|
346
|
+
end
|
347
|
+
|
348
|
+
it 'seconds past the minute 5,6 day 2' do
|
349
|
+
expect(desc('5,6 0 0 2 * *')).to eq('A 5 e 6 secondi dopo il minuto, il giorno 2 del mese')
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
context 'increments starting at X > 1:' do
|
354
|
+
it 'second increments' do
|
355
|
+
expect(desc('5/15 0 * * * *')).to eq('Ogni 15 secondi, a partire da a 5 secondi dopo il minuto')
|
356
|
+
end
|
357
|
+
|
358
|
+
it 'minute increments' do
|
359
|
+
expect(desc('30/10 * * * *')).to eq('Ogni 10 minuti, a partire da alle(ai) 30 minuti dopo l\'ora')
|
360
|
+
end
|
361
|
+
|
362
|
+
it 'hour increments' do
|
363
|
+
expect(desc('0 30 2/6 * * ?')).to eq('Alle(ai) 30 minuti dopo l\'ora, ogni 6 ore, a partire da alle(ai) 2:00 AM')
|
364
|
+
end
|
365
|
+
|
366
|
+
it 'day of month increments' do
|
367
|
+
expect(desc('0 30 8 2/7 * *')).to eq('Alle(ai) 8:30 AM, ogni 7 giorni, a partire da il giorno 2 del mese')
|
368
|
+
end
|
369
|
+
|
370
|
+
it 'day of week increments' do
|
371
|
+
expect(desc('0 30 11 * * 2/2')).to eq('Alle(ai) 11:30 AM, 2 giorni alla settimana, a partire da il martedì')
|
372
|
+
end
|
373
|
+
|
374
|
+
it 'month increments' do
|
375
|
+
expect(desc('0 20 10 * 2/3 THU')).to eq('Alle(ai) 10:20 AM, solo di giovedì, ogni 3 mesi, a partire da febbraio')
|
376
|
+
end
|
377
|
+
|
378
|
+
it 'year increments' do
|
379
|
+
expect(desc('0 0 0 1 MAR * 2010/5')).to eq('Alle(ai) 12:00 AM, il giorno 1 del mese, solo a(nel) marzo, ogni 5 anni, a partire da 2010')
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
@@ -5,7 +5,8 @@ module Cronex
|
|
5
5
|
describe ExpressionDescriptor do
|
6
6
|
|
7
7
|
def desc(expression, opts = {})
|
8
|
-
|
8
|
+
opts[:locale] = 'pt_BR'
|
9
|
+
Cronex::ExpressionDescriptor.new(expression, opts).description
|
9
10
|
end
|
10
11
|
|
11
12
|
let(:opts) { { zero_based_dow: false } }
|
@@ -375,7 +376,7 @@ module Cronex
|
|
375
376
|
end
|
376
377
|
|
377
378
|
it 'year increments' do
|
378
|
-
expect(desc('0 0 0 1 MAR * 2010/5')).to eq('Às
|
379
|
+
expect(desc('0 0 0 1 MAR * 2010/5')).to eq('Às 12:00 AM, no dia 1 do mês, em março, a cada 5 anos, iniciando em 2010')
|
379
380
|
end
|
380
381
|
end
|
381
382
|
end
|