Created
September 2, 2022 20:48
-
-
Save misteral/3c160a757f0b5b97e3d27f0f131d16c6 to your computer and use it in GitHub Desktop.
Rufus-scheduler alive test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'test_helper' | |
class RufusTest < ActionDispatch::IntegrationTest | |
test 'rufus loading' do | |
assert_predicate self, :rufus? | |
end | |
def rufus_running?(instance) | |
return false unless instance.up? | |
return false unless instance.thread.alive? | |
true | |
end | |
def rufus? | |
return false unless defined?(Rufus::Scheduler) | |
ObjectSpace.each_object(Rufus::Scheduler) do |o| | |
return true if rufus_running?(o) | |
end | |
false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment