mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Merge pull request #252 from betelgeuse/redirects_on_delete
Redirects on delete
This commit is contained in:
commit
a9d1526f0f
2 changed files with 16 additions and 5 deletions
|
@ -179,7 +179,7 @@ module Sidekiq
|
|||
s = score.to_f
|
||||
process_score('schedule', s, :delete)
|
||||
end
|
||||
redirect root_path
|
||||
redirect "#{root_path}scheduled"
|
||||
end
|
||||
|
||||
post '/retries' do
|
||||
|
@ -192,7 +192,7 @@ module Sidekiq
|
|||
process_score('retry', s, :delete)
|
||||
end
|
||||
end
|
||||
redirect root_path
|
||||
redirect "#{root_path}retries"
|
||||
end
|
||||
|
||||
post "/retries/:score" do
|
||||
|
@ -203,7 +203,7 @@ module Sidekiq
|
|||
elsif params['delete']
|
||||
process_score('retry', score, :delete)
|
||||
end
|
||||
redirect root_path
|
||||
redirect "#{root_path}retries"
|
||||
end
|
||||
|
||||
def process_score(set, score, operation)
|
||||
|
|
|
@ -81,6 +81,17 @@ class TestWeb < MiniTest::Unit::TestCase
|
|||
assert_match /HardWorker/, last_response.body
|
||||
end
|
||||
|
||||
it 'can delete scheduled' do
|
||||
msg,score = add_scheduled
|
||||
Sidekiq.redis do |conn|
|
||||
assert_equal 1, conn.zcard('schedule')
|
||||
post '/scheduled', 'score' => [score], 'delete' => 'Delete'
|
||||
assert_equal 302, last_response.status
|
||||
assert_equal 'http://example.org/scheduled', last_response.header['Location']
|
||||
assert_equal 0, conn.zcard('schedule')
|
||||
end
|
||||
end
|
||||
|
||||
it 'can display retries' do
|
||||
get '/retries'
|
||||
assert_equal 200, last_response.status
|
||||
|
@ -110,7 +121,7 @@ class TestWeb < MiniTest::Unit::TestCase
|
|||
|
||||
post "/retries/#{score}", 'delete' => 'Delete'
|
||||
assert_equal 302, last_response.status
|
||||
assert_equal 'http://example.org/', last_response.header['Location']
|
||||
assert_equal 'http://example.org/retries', last_response.header['Location']
|
||||
|
||||
get "/retries"
|
||||
assert_equal 200, last_response.status
|
||||
|
@ -122,7 +133,7 @@ class TestWeb < MiniTest::Unit::TestCase
|
|||
|
||||
post "/retries/#{score}", 'retry' => 'Retry'
|
||||
assert_equal 302, last_response.status
|
||||
assert_equal 'http://example.org/', last_response.header['Location']
|
||||
assert_equal 'http://example.org/retries', last_response.header['Location']
|
||||
|
||||
get '/queues/default'
|
||||
assert_equal 200, last_response.status
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue