@@ -218,66 +218,71 @@ def get_milestone(milestone_name:)
218
218
end
219
219
220
220
it 'computes the correct dates for standard period' do
221
- due_date = '2022-10-20T08 :00:00Z' . to_time . utc
221
+ due_date = '2022-12-02T08 :00:00Z' . to_time . utc
222
222
options = {
223
- due_on : '2022-10-20T12 :00:00Z' ,
224
- description : "Code freeze: October 20 , 2022\n App Store submission: October 24 , 2022\n Release: October 27 , 2022\n "
223
+ due_on : '2022-12-02T12 :00:00Z' ,
224
+ description : "Code freeze: December 02 , 2022\n App Store submission: December 06 , 2022\n Release: December 09 , 2022\n "
225
225
}
226
226
227
227
expect ( client ) . to receive ( :create_milestone ) . with ( test_repo , test_milestone_number , options )
228
228
create_milestone ( due_date : due_date , days_until_submission : 4 , days_until_release : 7 )
229
229
end
230
230
231
- it 'computes the correct dates when the due date is on the verge of a DST day change' do
232
- # The PST to PDT (DST) change is made on the second Sunday in March and finishes on the first Sunday in November
233
- Time . zone = 'Pacific Time (US & Canada)'
234
- due_date = '2022-06-18T23:00:00Z' . to_time
231
+ it 'computes the correct dates when submission and release dates are in the same day' do
232
+ due_date = '2022-12-02T08:00:00Z' . to_time . utc
235
233
options = {
236
- due_on : '2022-06-19T12 :00:00Z' ,
237
- description : "Code freeze: June 19 , 2022\n App Store submission: June 21 , 2022\n Release: June 22 , 2022\n "
234
+ due_on : '2022-12-02T12 :00:00Z' ,
235
+ description : "Code freeze: December 02 , 2022\n App Store submission: December 03 , 2022\n Release: December 03 , 2022\n "
238
236
}
239
237
240
238
expect ( client ) . to receive ( :create_milestone ) . with ( test_repo , test_milestone_number , options )
241
- create_milestone ( due_date : due_date , days_until_submission : 2 , days_until_release : 3 )
239
+ create_milestone ( due_date : due_date , days_until_submission : 1 , days_until_release : 1 )
242
240
end
243
241
244
- it 'computes the correct dates when the due date is on DST but has no day change' do
245
- # The PST to PDT (DST) change is made on the second Sunday in March and finishes on the first Sunday in November
246
- Time . zone = 'Pacific Time (US & Canada)'
247
- due_date = '2022-06-18T22:00:00Z' . to_time
248
- options = {
249
- due_on : '2022-06-18T12:00:00Z' ,
250
- description : "Code freeze: June 18, 2022\n App Store submission: June 20, 2022\n Release: June 21, 2022\n "
251
- }
252
-
253
- expect ( client ) . to receive ( :create_milestone ) . with ( test_repo , test_milestone_number , options )
254
- create_milestone ( due_date : due_date , days_until_submission : 2 , days_until_release : 3 )
242
+ it 'computes the correct dates when the due date is on the verge of a DST day change' do
243
+ # DST starts on the last Sunday of March and ends on the last Sunday of October
244
+ Time . use_zone ( 'Europe/London' ) do
245
+ due_date = Time . zone . parse ( '2022-03-27 23:00:00Z' )
246
+ options = {
247
+ due_on : '2022-03-28T12:00:00Z' ,
248
+ description : "Code freeze: March 28, 2022\n App Store submission: March 30, 2022\n Release: March 31, 2022\n "
249
+ }
250
+
251
+ expect ( client ) . to receive ( :create_milestone ) . with ( test_repo , test_milestone_number , options )
252
+ create_milestone ( due_date : due_date , days_until_submission : 2 , days_until_release : 3 )
253
+ end
255
254
end
256
255
257
- context 'with input validation' do
258
- it 'raises an error if days_until_submission is less than or equal zero' do
259
- due_date = '2022-10-20T08:00:00Z' . to_time . utc
260
- expect { create_milestone ( due_date : due_date , days_until_submission : 0 , days_until_release : 5 ) }
261
- . to raise_error ( FastlaneCore ::Interface ::FastlaneError , 'days_until_submission must be greater than zero.' )
256
+ it 'computes the correct dates when the due date is on DST but has no day change' do
257
+ # DST starts on the last Sunday of March and ends on the last Sunday of October
258
+ Time . use_zone ( 'Europe/London' ) do
259
+ due_date = Time . zone . parse ( '2022-03-26 23:00:00Z' )
260
+ options = {
261
+ due_on : '2022-03-26T12:00:00Z' ,
262
+ description : "Code freeze: March 26, 2022\n App Store submission: March 28, 2022\n Release: March 29, 2022\n "
263
+ }
264
+
265
+ expect ( client ) . to receive ( :create_milestone ) . with ( test_repo , test_milestone_number , options )
266
+ create_milestone ( due_date : due_date , days_until_submission : 2 , days_until_release : 3 )
262
267
end
268
+ end
263
269
264
- it 'raises an error if days_until_release is less than or equal zero' do
265
- due_date = '2022-10-20T08:00:00Z' . to_time . utc
266
- expect { create_milestone ( due_date : due_date , days_until_submission : 12 , days_until_release : - 8 ) }
267
- . to raise_error ( FastlaneCore ::Interface ::FastlaneError , 'days_until_release must be greater than zero.' )
268
- end
270
+ it 'raises an error if days_until_submission is less than or equal zero' do
271
+ due_date = '2022-10-20T08:00:00Z' . to_time . utc
272
+ expect { create_milestone ( due_date : due_date , days_until_submission : 0 , days_until_release : 5 ) }
273
+ . to raise_error ( FastlaneCore ::Interface ::FastlaneError , 'days_until_submission must be greater than zero.' )
274
+ end
269
275
270
- it 'raises an error if submission date is after the release date ' do
271
- due_date = '2022-10-20T08:00:00Z' . to_time . utc
272
- expect { create_milestone ( due_date : due_date , days_until_submission : 14 , days_until_release : 3 ) }
273
- . to raise_error ( FastlaneCore ::Interface ::FastlaneError , 'days_until_release must be greather than days_until_submission ' )
274
- end
276
+ it 'raises an error if days_until_release is less than or equal zero ' do
277
+ due_date = '2022-10-20T08:00:00Z' . to_time . utc
278
+ expect { create_milestone ( due_date : due_date , days_until_submission : 12 , days_until_release : - 8 ) }
279
+ . to raise_error ( FastlaneCore ::Interface ::FastlaneError , 'days_until_release must be greater than zero. ' )
280
+ end
275
281
276
- it 'raises an error if submission date is equal to release date' do
277
- due_date = '2022-10-20T08:00:00Z' . to_time . utc
278
- expect { create_milestone ( due_date : due_date , days_until_submission : 1 , days_until_release : 1 ) }
279
- . to raise_error ( FastlaneCore ::Interface ::FastlaneError , 'days_until_release must be greather than days_until_submission' )
280
- end
282
+ it 'raises an error if days_until_submission is greater than days_until_release' do
283
+ due_date = '2022-10-20T08:00:00Z' . to_time . utc
284
+ expect { create_milestone ( due_date : due_date , days_until_submission : 14 , days_until_release : 3 ) }
285
+ . to raise_error ( FastlaneCore ::Interface ::FastlaneError , 'days_until_release must be greater or equal to days_until_submission.' )
281
286
end
282
287
283
288
def create_milestone ( due_date :, days_until_submission :, days_until_release :)
0 commit comments