test/plugins/processing_window_test.rb in rocketjob-3.0.0.rc5 vs test/plugins/processing_window_test.rb in rocketjob-3.0.0
- old
+ new
@@ -30,21 +30,21 @@
refute @job.new_record?
end
describe 'timezones are supported' do
it 'handles UTC' do
- time = Time.parse('2015-12-09 17:50:05 +0000')
+ time = Time.parse('2015-12-09 17:50:05 UTC')
Time.stub(:now, time) do
@job = ProcessingWindowJob.create!(processing_schedule: '* 1 * * * UTC', processing_duration: 1.hour)
end
assert @job.valid?
refute @job.new_record?
assert_equal Time.parse('2015-12-10 01:00:00 UTC'), @job.run_at
end
it 'handles Eastern' do
- time = Time.parse('2015-12-09 17:50:05 +0000')
+ time = Time.parse('2015-12-09 17:50:05 UTC')
Time.stub(:now, time) do
@job = ProcessingWindowJob.create!(processing_schedule: '* 1 * * * America/New_York', processing_duration: 1.hour)
end
assert @job.valid?
refute @job.new_record?
@@ -53,20 +53,20 @@
end
end
describe '#rocket_job_processing_window_active?' do
it 'returns true when in the processing window' do
- time = Time.parse('2015-12-09 17:50:05 +0000')
+ time = Time.parse('2015-12-09 17:50:05 UTC')
@job = ProcessingWindowJob.new(processing_schedule: '* 17 * * * UTC', processing_duration: 1.hour)
result = Time.stub(:now, time) do
@job.rocket_job_processing_window_active?
end
assert result, @job.attributes.ai
end
it 'returns false when not in the processing window' do
- time = Time.parse('2015-12-09 16:50:05 +0000')
+ time = Time.parse('2015-12-09 16:50:05 UTC')
@job = ProcessingWindowJob.new(processing_schedule: '* 17 * * * UTC', processing_duration: 1.hour)
result = Time.stub(:now, time) do
@job.rocket_job_processing_window_active?
end
refute result, @job.attributes.ai
@@ -94,10 +94,10 @@
end
end
describe 're-queue' do
it 'if outside processing window' do
- time = Time.parse('2015-12-09 16:50:05 +0000')
+ time = Time.parse('2015-12-09 16:50:05 UTC')
Time.stub(:now, time) do
@job = ProcessingWindowJob.new(processing_schedule: '* 17 * * * UTC', processing_duration: 1.hour)
@job.perform_now
end
assert @job.queued?, @job.attributes.ai