Sha256: 185294e781ba3bebe0d0b96b83571df04a18815b871ed077858ced0a62650a54

Contents?: true

Size: 653 Bytes

Versions: 3

Compression:

Stored size: 653 Bytes

Contents

# encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/inputs/relp"
require "logstash/util/relp"
require "socket"
require "support/client"

class RelpHelpers

  def self.setup_clients(number_of_clients, port)
    number_of_clients.times.inject([]) do |clients|
      clients << RelpClient.new("0.0.0.0", port, ["syslog"])
    end
  end

  def self.filter(events, message)
     events.select{|event| event["message"] == message }
  end
end

RSpec::Matchers.define :have do |nevents|

  match do |events|
    RelpHelpers.filter(events, @pattern).size == nevents
  end

  chain :with do |pattern|
    @pattern = pattern
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
logstash-input-relp-2.0.5 spec/spec_helper.rb
logstash-input-relp-2.0.3 spec/spec_helper.rb
logstash-input-relp-2.0.2 spec/spec_helper.rb