Sha256: 552c430266299f035016caadb0909e8e97d84ebfefdc6e7235733acd82e00d67

Contents?: true

Size: 358 Bytes

Versions: 5

Compression:

Stored size: 358 Bytes

Contents

require 'sidekiq/api'

ExpectedDataNotFoundError = Class.new(StandardError)

def wait_for(&block)
  10.tries on: ExpectedDataNotFoundError, delay: 0.1 do
    block.call or raise ExpectedDataNotFoundError
  end
end

def wait_for_job_to_run(jid)
  wait_for do
    Sidekiq::Workers.new.any? do |_, _, work|
      work['payload']['jid'] == jid
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
services-0.2.5 spec/support/helpers.rb
services-0.2.4 spec/support/helpers.rb
services-0.2.2 spec/support/helpers.rb
services-0.2.1 spec/support/helpers.rb
services-0.1.7 spec/support/helpers.rb