diff --git a/test/test_timeout.rb b/test/test_timeout.rb index 5db355a..cf41102 100644 --- a/test/test_timeout.rb +++ b/test/test_timeout.rb @@ -464,10 +464,12 @@ def test_timeout_in_trap_handler # Stubs Fiber.current_scheduler for the duration of the block, then restores it. def with_mock_scheduler(mock) original = Fiber.method(:current_scheduler) + Fiber.singleton_class.remove_method(:current_scheduler) Fiber.define_singleton_method(:current_scheduler) { mock } begin yield ensure + Fiber.singleton_class.remove_method(:current_scheduler) Fiber.define_singleton_method(:current_scheduler, original) end end