GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of mojombo/god
Description: Ruby process monitor
Homepage: http://god.rubyforge.org
Clone URL: git://github.com/auser/god.git
god / test / test_socket.rb
100644 43 lines (36 sloc) 0.905 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require File.dirname(__FILE__) + '/helper'
 
class TestSocket < Test::Unit::TestCase
  def setup
    silence_warnings do
      Object.const_set(:DRb, stub_everything)
    end
  end
 
  def test_should_start_a_drb_server
    DRb.expects(:start_service)
    no_stdout do
      God::Socket.new
    end
  end
 
  def test_should_use_supplied_port_and_host
    DRb.expects(:start_service).with { |uri, object| uri == "drbunix:///tmp/god.9999.sock" && object.is_a?(God::Socket) }
    no_stdout do
      server = God::Socket.new(9999)
    end
  end
 
  def test_should_forward_foreign_method_calls_to_god
    server = nil
    no_stdout do
      server = God::Socket.new
    end
    God.expects(:send).with(:something_random)
    server.something_random
  end
  
  # ping
  
  def test_ping_should_return_true
    server = nil
    no_stdout do
      server = God::Socket.new
    end
    assert server.ping
  end
end