Sha256: 800820c794debfe1a217a3412efefc55252003bb8f1683328692316f99a63edf

Contents?: true

Size: 792 Bytes

Versions: 6

Compression:

Stored size: 792 Bytes

Contents

require File.expand_path('../helper', __FILE__)

class TestRemoteSyslogLogger < Test::Unit::TestCase
  def setup
    @server_port = rand(50000) + 1024
    @socket = UDPSocket.new
    @socket.bind('127.0.0.1', @server_port)
  end
  
  def test_logger
    @logger = RemoteSyslogLogger.new('127.0.0.1', @server_port)
    @logger.info "This is a test"
    
    message, addr = *@socket.recvfrom(1024)
    assert_match /This is a test/, message
  end

  def test_logger_multiline
    @logger = RemoteSyslogLogger.new('127.0.0.1', @server_port)
    @logger.info "This is a test\nThis is the second line"

    message, addr = *@socket.recvfrom(1024)
    assert_match /This is a test/, message

    message, addr = *@socket.recvfrom(1024)
    assert_match /This is the second line/, message
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
remote_syslog_logger_custom-1.0.4 test/test_remote_syslog_logger.rb
remote_syslog_logger_custom-1.0.3 test/test_remote_syslog_logger.rb
remote_syslog_logger_tcp-1.0.3 test/test_remote_syslog_logger.rb
remote_syslog_logger-1.0.3 test/test_remote_syslog_logger.rb
remote_syslog_logger-1.0.2 test/test_remote_syslog_logger.rb
remote_syslog_logger-1.0.1 test/test_remote_syslog_logger.rb