Sha256: 6185450d91b66e2ba42eb13f59e19b0ae3c7466287253a75479deebe678a4730
Contents?: true
Size: 1.86 KB
Versions: 34
Compression:
Stored size: 1.86 KB
Contents
require 'test_helper' module Workarea class VerifyScheduledReleasesTest < TestCase setup :set_sidekiq teardown :reset_sidekiq def set_sidekiq Sidekiq::Testing.disable! @scheduled_set = Sidekiq::ScheduledSet.new @scheduled_set.clear end def reset_sidekiq Sidekiq::Testing.inline! end def test_rescheduling_publish release = create_release(publish_at: Time.current + 1.hour) assert(release.publish_job_id.present?) original_job_id = release.publish_job_id @scheduled_set.clear VerifyScheduledReleases.new.perform release.reload refute_equal(original_job_id, release.publish_job_id) assert_equal(1, @scheduled_set.size) end def test_skipping_publish_dates_in_the_past release = create_release release.update_attribute(:publish_at, Time.current - 1.hour) release.update_attribute(:publish_job_id, '123') VerifyScheduledReleases.new.perform release.reload assert_equal('123', release.publish_job_id) assert_equal(0, @scheduled_set.size) end def test_rescheduling_undo release = create_release(published_at: Time.current, undo_at: Time.current + 1.hour) assert(release.undo_job_id.present?) original_job_id = release.undo_job_id @scheduled_set.clear VerifyScheduledReleases.new.perform release.reload refute_equal(original_job_id, release.undo_job_id) assert_equal(1, @scheduled_set.size) end def test_skipping_undo_dates_in_the_past release = create_release(published_at: Time.current) release.update_attribute(:undo_at, Time.current - 1.hour) release.update_attribute(:undo_job_id, '123') VerifyScheduledReleases.new.perform release.reload assert_equal('123', release.undo_job_id) assert_equal(0, @scheduled_set.size) end end end
Version data entries
34 entries across 34 versions & 1 rubygems