diff options
| author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-02 22:50:01 +0000 |
|---|---|---|
| committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-02 22:50:01 +0000 |
| commit | bc7c19fba0a63e9d84d4219d646499aff80e8f1e (patch) | |
| tree | ad123cbf7356dc512af98cb00ec7eba78dc78a21 /test/xmlrpc/webrick_testing.rb | |
| parent | 9844314c77bd80c549eca34c09d0bf19ba0e5e07 (diff) | |
| download | ruby-bc7c19fba0a63e9d84d4219d646499aff80e8f1e.tar.gz ruby-bc7c19fba0a63e9d84d4219d646499aff80e8f1e.tar.xz ruby-bc7c19fba0a63e9d84d4219d646499aff80e8f1e.zip | |
This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/xmlrpc/webrick_testing.rb')
| -rw-r--r-- | test/xmlrpc/webrick_testing.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/xmlrpc/webrick_testing.rb b/test/xmlrpc/webrick_testing.rb new file mode 100644 index 000000000..a6830cece --- /dev/null +++ b/test/xmlrpc/webrick_testing.rb @@ -0,0 +1,37 @@ +require 'timeout' + +module WEBrick_Testing + class DummyLog < WEBrick::BasicLog + def initialize() super(self) end + def <<(*args) end + end + + def start_server(config={}) + raise "already started" if @__server + @__started = false + + Thread.new { + @__server = WEBrick::HTTPServer.new( + { + :Logger => DummyLog.new, + :AccessLog => [], + :StartCallback => proc { @__started = true } + }.update(config)) + yield @__server + @__server.start + @__started = false + } + + Timeout.timeout(5) { + nil until @__started # wait until the server is ready + } + end + + def stop_server + Timeout.timeout(5) { + @__server.shutdown + nil while @__started # wait until the server is down + } + @__server = nil + end +end |
