Skip to content

Instantly share code, notes, and snippets.

@jkraemer
Created March 24, 2011 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkraemer/885592 to your computer and use it in GitHub Desktop.
Save jkraemer/885592 to your computer and use it in GitHub Desktop.
monkey patch for test::unit for testing evented libraries
require 'em-synchrony'
require 'test/unit/autorunner'
# Patch test::unit to run stuff inside the EM reactor
module Test
module Unit
class AutoRunner
alias_method :run_alias, :run
def run(*args, &block)
EM.synchrony do
result = run_alias(*args, &block)
EM.stop
result
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment