add ideas dir with future conf and execve test
[god.git] / test / test_server.rb
blobe413274b62b59dbe85016504a0db0fd7f5b466d8
1 require File.dirname(__FILE__) + '/helper'
3 class TestServer < 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       Server.new
14     end
15   end
17   def test_should_use_supplied_port_and_host
18     DRb.expects(:start_service).with { |uri, object| uri == "druby://host:port" && object.is_a?(Server) }
19     no_stdout do
20       server = Server.new('host', 'port')
21     end
22   end
24   def test_should_forward_foreign_method_calls_to_god
25     server = nil
26     no_stdout do
27       server = Server.new
28     end
29     God.expects(:send).with(:something_random)
30     server.something_random
31   end
32   
33   def test_should_install_deny_all_by_default
34     ACL.expects(:new).with(%w{deny all})
35     no_stdout do
36       Server.new
37     end
38   end
39   
40   def test_should_install_pass_through_acl
41     ACL.expects(:new).with(%w{deny all allow 127.0.0.1 allow 0.0.0.0})
42     no_stdout do
43       Server.new(nil, 17165, %w{127.0.0.1 0.0.0.0})
44     end
45   end
46   
47   # ping
48   
49   def test_ping_should_return_true
50     server = nil
51     no_stdout do
52       server = Server.new
53     end
54     assert server.ping
55   end
56 end