Sha256: f9657a9d799a55bde348bf243646258a0678364b067ff1c613075b1702a3d42a

Contents?: true

Size: 897 Bytes

Versions: 6

Compression:

Stored size: 897 Bytes

Contents

require 'helper'

class TestRubyUdpSender < Test::Unit::TestCase
  context "with ruby sender" do
    setup do
      @addresses = [['localhost', 12201], ['localhost', 12202]]
      @sender = GELF::RubyUdpSender.new(@addresses)
      @datagrams1 = %w(d1 d2 d3)
      @datagrams2 = %w(e1 e2 e3)
    end

    context "send_datagrams" do
      setup do
        @sender.send_datagrams(@datagrams1)
        @sender.send_datagrams(@datagrams2)
      end

      before_should "be called 3 times with 1st and 2nd address" do
        UDPSocket.any_instance.expects(:send).times(3).with do |datagram, _, host, port|
          datagram.start_with?('d') && host == 'localhost' && port == 12201
        end
        UDPSocket.any_instance.expects(:send).times(3).with do |datagram, _, host, port|
          datagram.start_with?('e') && host == 'localhost' && port == 12202
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gelf-2.0.0 test/test_ruby_sender.rb
gelf-1.4.0 test/test_ruby_sender.rb
gelf-1.4.0.beta1 test/test_ruby_sender.rb
gelf-1.3.2 test/test_ruby_sender.rb
gelf-1.3.1 test/test_ruby_sender.rb
gelf-1.2.0.beta1 test/test_ruby_sender.rb