Sha256: ccef4ea7819d173bfbd82d6f5a80b7ec7e806bf4511a8bf2ca2724158eab405e

Contents?: true

Size: 1.09 KB

Versions: 28

Compression:

Stored size: 1.09 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
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.26 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.25 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.23 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.22 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.21 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.20 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.19 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.18 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.17 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.16 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.15 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.14 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.13 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.12 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.11 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.10 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.9 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.8 test/workers/workarea/verify_scheduled_releases_test.rb
workarea-core-3.5.7 test/workers/workarea/verify_scheduled_releases_test.rb