Skip to content

Instantly share code, notes, and snippets.

@misteral
Created September 2, 2022 20:48
Show Gist options
  • Save misteral/3c160a757f0b5b97e3d27f0f131d16c6 to your computer and use it in GitHub Desktop.
Save misteral/3c160a757f0b5b97e3d27f0f131d16c6 to your computer and use it in GitHub Desktop.
Rufus-scheduler alive test
# 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