Sha256: 34134ba35575e0425e253808eab54a48398e8f7124506927d8e37e0221f7c0d6

Contents?: true

Size: 688 Bytes

Versions: 1

Compression:

Stored size: 688 Bytes

Contents

require_relative 'helper'

class TestWorker < Sidetiq::TestCase
  class FakeWorker
    include Sidetiq::Schedulable
  end

  def test_timestamps_for_new_worker
    assert FakeWorker.last_scheduled_occurrence == -1
    assert FakeWorker.next_scheduled_occurrence == -1
  end

  def test_timestamps_for_existing_worker
    last_run = (Time.now - 100).to_f
    next_run = (Time.now + 100).to_f

    Sidekiq.redis do |redis|
      redis.set "sidetiq:TestWorker::FakeWorker:last", last_run
      redis.set "sidetiq:TestWorker::FakeWorker:next", next_run
    end

    assert FakeWorker.last_scheduled_occurrence == last_run
    assert FakeWorker.next_scheduled_occurrence == next_run
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidetiq-0.2.0 test/test_worker.rb