mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
use start_with? instead of starts_with? which is only available on Rails (#5621)
This commit is contained in:
parent
0e91f175fe
commit
ef8d4425b6
2 changed files with 23 additions and 1 deletions
|
@ -324,7 +324,7 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def pollable?
|
def pollable?
|
||||||
!(current_path == "" || current_path.starts_with?("metrics"))
|
!(current_path == "" || current_path.start_with?("metrics"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def retry_or_delete_or_kill(job, params)
|
def retry_or_delete_or_kill(job, params)
|
||||||
|
|
|
@ -30,6 +30,10 @@ class Helpers
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def path_info
|
||||||
|
@thehash[:path_info]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Web helpers" do
|
describe "Web helpers" do
|
||||||
|
@ -180,4 +184,22 @@ describe "Web helpers" do
|
||||||
assert obj.sorted_processes.all? { |process| assert_instance_of Sidekiq::Process, process }
|
assert obj.sorted_processes.all? { |process| assert_instance_of Sidekiq::Process, process }
|
||||||
assert_equal ["worker_critical.1", "worker_critical.2", "worker_critical.10", "worker_default.1", "worker_default.2"], obj.sorted_processes.map { |process| process["hostname"] }
|
assert_equal ["worker_critical.1", "worker_critical.2", "worker_critical.10", "worker_default.1", "worker_default.2"], obj.sorted_processes.map { |process| process["hostname"] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#pollable?" do
|
||||||
|
it "returns true if not the root or metrics path" do
|
||||||
|
obj = Helpers.new({path_info: "/retries"})
|
||||||
|
|
||||||
|
assert obj.pollable?
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false if the root or metrics path" do
|
||||||
|
obj = Helpers.new({path_info: "/metrics"})
|
||||||
|
|
||||||
|
assert_equal false, obj.pollable?
|
||||||
|
|
||||||
|
obj = Helpers.new({path_info: "/"})
|
||||||
|
|
||||||
|
assert_equal false, obj.pollable?
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue