test/plugins/cron_test.rb in rocketjob-3.3.3 vs test/plugins/cron_test.rb in rocketjob-3.3.4
- old
+ new
@@ -52,9 +52,25 @@
end
end
end
+ describe '#save' do
+ it 'updates run_at for a new record' do
+ @job = CronJob.create!(cron_schedule: '* 1 * * *')
+ assert @job.run_at
+ end
+
+ it 'updates run_at for a modified record' do
+ @job = CronJob.create!(cron_schedule: '* 1 * * * UTC')
+ assert run_at = @job.run_at
+ @job.cron_schedule = '* 2 * * * UTC'
+ assert_equal run_at, @job.run_at
+ @job.save!
+ assert run_at < @job.run_at
+ end
+ end
+
describe '#valid?' do
it 'fails on missing cron schedule' do
@job = CronJob.new
refute @job.valid?
assert_equal "can't be blank", @job.errors.messages[:cron_schedule].first