tighten up Hub and add comments
[god.git] / test / test_socket.rb
blob8ae421989407cebefdbc5d1628335d6584798b74
1 require File.dirname(__FILE__) + '/helper'
3 class TestSocket < Test::Unit::TestCase
4   def setup
5     silence_warnings do 
6       Object.const_set(:DRb, stub_everything)
7     end
8   end
10   def test_should_start_a_drb_server
11     DRb.expects(:start_service)
12     no_stdout do
13       God::Socket.new
14     end
15   end
17   def test_should_use_supplied_port_and_host
18     DRb.expects(:start_service).with { |uri, object| uri == "drbunix:///tmp/god.9999.sock" && object.is_a?(God::Socket) }
19     no_stdout do
20       server = God::Socket.new(9999)
21     end
22   end
24   def test_should_forward_foreign_method_calls_to_god
25     server = nil
26     no_stdout do
27       server = God::Socket.new
28     end
29     God.expects(:send).with(:something_random)
30     server.something_random
31   end
32   
33   # ping
34   
35   def test_ping_should_return_true
36     server = nil
37     no_stdout do
38       server = God::Socket.new
39     end
40     assert server.ping
41   end
42 end