spec/spec_helper.rb in dripdrop-0.3.1 vs spec/spec_helper.rb in dripdrop-0.4.0
- old
+ new
@@ -1,6 +1,20 @@
-require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib dripdrop]))
+require File.expand_path(File.join(File.dirname(__FILE__), %w[. .. lib dripdrop]))
Thread.abort_on_exception = true
-def rand_addr
- "tcp://127.0.0.1:#{rand(10_000) + 20_000}"
+# Used to test websocket clients.
+require 'gimite-websocket'
+
+def rand_addr(scheme='tcp')
+ "#{scheme}://127.0.0.1:#{rand(10_000) + 20_000}"
end
+
+def run_reactor(time=0.1,opts={},&block)
+ ddn = DripDrop::Node.new(opts,&block)
+ ddn.start
+ sleep time
+ ddn.stop
+ sleep 0.1
+ ddn
+end
+
+