Created
March 24, 2011 18:37
-
-
Save jkraemer/885592 to your computer and use it in GitHub Desktop.
monkey patch for test::unit for testing evented libraries
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
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