use start_with? instead of starts_with? which is only available on Rails (#5621)

This commit is contained in:
Marcelo Lauxen 2022-11-05 08:09:33 -07:00 committed by GitHub
parent 0e91f175fe
commit ef8d4425b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -324,7 +324,7 @@ module Sidekiq
end
def pollable?
!(current_path == "" || current_path.starts_with?("metrics"))
!(current_path == "" || current_path.start_with?("metrics"))
end
def retry_or_delete_or_kill(job, params)

View File

@ -30,6 +30,10 @@ class Helpers
{
}
end
def path_info
@thehash[:path_info]
end
end
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_equal ["worker_critical.1", "worker_critical.2", "worker_critical.10", "worker_default.1", "worker_default.2"], obj.sorted_processes.map { |process| process["hostname"] }
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