Closed CodeMonkeySteve closed 4 years ago
👍👍
I wouldn't be surprised if some of these failures are due to Mongrel specific behavior(s), but regardless this looks really promising. Thanks for driving this!
It looks like WEBrick might not be the best replacement for Mongrel. Aside from the different behavior that breaks the tests, it also doesn't support 100-continue (and breaks if you try to use it). Thin seems to work better, but since it uses EM, every call to EM.stop
also stops the Stallion server (even if it's on another thread), and I don't know how to wrap all of RSpec in EM.run
.
Oh there’s a wiki page in the EM wiki, someone dropped in an example of an EM.run unit test wrapper. (Can’t find at the moment as I am on my phone.)
It's easy to run each test in an EM block with an around
filter, the problem is that any servers or connections (i.e. the Stallion server) need to be restarted before each test, as EM.stop
kills their sockets.
Alternatively, we could monkey-patch RSpec to run the whole test suite in an EM block, but then we'd need some way for tests to indicate success/failure (each test would only end after some callback fires).
I've run into this issue on every project where I use EM, and haven't yet found a good solution.
Per https://github.com/igrigorik/em-http-request/pull/327#issuecomment-411124401, closing. Feel free to reopen if you want to resurrect this.
(Mongrel is no longer supported with by Rack v2+)
Remaining test failures: