Sha256: 142eb7c690dc3f6abbcc4d9b3f69ed818c2ee4939abac523b65b4bc6b0befaa3

Contents?: true

Size: 898 Bytes

Versions: 9

Compression:

Stored size: 898 Bytes

Contents

require 'helper'

class TestRubyUdpSender < Test::Unit::TestCase
  context "with ruby sender" do
    setup do
      @addresses = [['localhost', 12201], ['localhost', 12202]]
      @sender = GELF::Transport::UDP.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

9 entries across 9 versions & 3 rubygems

Version Path
gelf_redux-3.2.2 test/test_ruby_sender.rb
gelf_redux-3.1.2 test/test_ruby_sender.rb
gelf_redux-3.2.1 test/test_ruby_sender.rb
gelf_redux-3.1.1 test/test_ruby_sender.rb
gelf.fitterpen-3.1.1 test/test_ruby_sender.rb
gelf.fitterpen-3.1.0 test/test_ruby_sender.rb
gelf-3.1.0 test/test_ruby_sender.rb
gelf-3.1.0.pre.rc.1 test/test_ruby_sender.rb
gelf-3.0.0 test/test_ruby_sender.rb