File: test_socket.rb

package info (click to toggle)
ruby-god 0.12.1-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 752 kB
  • sloc: ruby: 5,913; ansic: 217; makefile: 3
file content (34 lines) | stat: -rw-r--r-- 792 bytes parent folder | download | duplicates (2)
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
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)
    God::Socket.new
  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) }
    server = God::Socket.new(9999)
  end

  def test_should_forward_foreign_method_calls_to_god
    server = nil
    server = God::Socket.new
    God.expects(:send).with(:something_random)
    server.something_random
  end

  # ping

  def test_ping_should_return_true
    server = nil
    server = God::Socket.new
    assert server.ping
  end
end