1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Revert "Allow tests to override enqueued_at", fixes #4149

This reverts commit cfe53e5fad.
This commit is contained in:
Mike Perham 2019-04-16 08:42:29 -07:00
parent 4b239606e5
commit 0a2559b193
2 changed files with 3 additions and 12 deletions

View file

@ -198,7 +198,7 @@ module Sidekiq
q = payloads.first['queue'] q = payloads.first['queue']
now = Time.now.to_f now = Time.now.to_f
to_push = payloads.map do |entry| to_push = payloads.map do |entry|
entry['enqueued_at'] ||= now entry['enqueued_at'] = now
Sidekiq.dump_json(entry) Sidekiq.dump_json(entry)
end end
conn.sadd('queues', q) conn.sadd('queues', q)

View file

@ -107,22 +107,13 @@ describe Sidekiq::Web do
end end
it 'can display queues' do it 'can display queues' do
assert Sidekiq::Client.push('queue' => :foo, 'class' => WebWorker, 'args' => [1, 3])
get '/queues'
assert_equal 200, last_response.status
assert_match(/foo/, last_response.body)
refute_match(/HardWorker/, last_response.body)
refute_match(/datetime/, last_response.body)
Sidekiq::Queue.new("foo").clear
assert Sidekiq::Client.push('queue' => :foo, 'class' => WebWorker, 'args' => [1, 3], 'enqueued_at' => Time.now.to_f - 65) assert Sidekiq::Client.push('queue' => :foo, 'class' => WebWorker, 'args' => [1, 3], 'enqueued_at' => Time.now.to_f - 65)
get '/queues' get '/queues'
assert_equal 200, last_response.status assert_equal 200, last_response.status
assert_match(/foo/, last_response.body) assert_match(/foo/, last_response.body)
refute_match(/WebWorker/, last_response.body) refute_match(/HardWorker/, last_response.body)
assert_match(/datetime/, last_response.body) assert_match(/seconds ago/, last_response.body)
end end
it 'handles queue view' do it 'handles queue view' do