Sha256: 9747cc6ca57e8023b8c10f9adb70c7566f78a7e7d4c4a5076dffdb0e80aa4f4f

Contents?: true

Size: 655 Bytes

Versions: 5

Compression:

Stored size: 655 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.set("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

5 entries across 5 versions & 1 rubygems

Version Path
logstash-input-relp-3.0.4 spec/spec_helper.rb
logstash-input-relp-3.0.3 spec/spec_helper.rb
logstash-input-relp-3.0.2 spec/spec_helper.rb
logstash-input-relp-3.0.1 spec/spec_helper.rb
logstash-input-relp-3.0.0 spec/spec_helper.rb