mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Add tests for fetch and updat method.
This commit is contained in:
parent
8dd8155552
commit
868bf43cfd
2 changed files with 19 additions and 0 deletions
|
@ -171,6 +171,7 @@ module Sidekiq
|
|||
else
|
||||
result << entry
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -47,6 +47,24 @@ class TestApi < MiniTest::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
it 'can fetch by score' do
|
||||
same_time = Time.now.to_f
|
||||
add_retry('bob1', same_time)
|
||||
add_retry('bob2', same_time)
|
||||
r = Sidekiq::RetrySet.new
|
||||
assert_equal 2, r.fetch(same_time).size
|
||||
end
|
||||
|
||||
it 'can fetch by score and jid' do
|
||||
same_time = Time.now.to_f
|
||||
add_retry('bob1', same_time)
|
||||
add_retry('bob2', same_time)
|
||||
r = Sidekiq::RetrySet.new
|
||||
# jobs = r.fetch(same_time)
|
||||
# puts jobs[1].jid
|
||||
assert_equal 1, r.fetch(same_time, 'bob1').size
|
||||
end
|
||||
|
||||
it 'shows empty retries' do
|
||||
r = Sidekiq::RetrySet.new
|
||||
assert_equal 0, r.size
|
||||
|
|
Loading…
Add table
Reference in a new issue