Sha256: b7333d9e7324dfa982a9abfaeb2c18b40e4a2f889f3a46d2f01d8d3c15eed655

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'pry'

RSpec.configure do |config|
  config.order = "random"

  config.before(:suite) do
    puts "Testing with #{CONNECTION_TYPE.to_s.upcase} socket type"
  end

  config.expect_with :rspec do |c|
    c.syntax = :expect
  end
end

HOST = ENV['HOST'] || '0.0.0.0'
PORT = ENV.fetch('PORT', 5228).to_i
CONNECTION_TYPE ||= (ENV['TYPE'] || 'UDP').to_s.downcase.to_sym

RSpec.shared_context 'logger' do
  # The type of connection we're testing
  def connection_type
    CONNECTION_TYPE
  end

  let(:host) { HOST }
  let(:hostname) { Socket.gethostname }
  let(:port) { PORT }

  # The logstash logger
  let(:logger) { LogStashLogger.new(host: host, port: port, type: connection_type) }
  # The log device that the logger writes to
  let(:logdev) { logger.instance_variable_get(:@logdev) }
end

RSpec.shared_context 'device' do
  let(:port) { PORT }
  let(:device_with_port) { LogStashLogger::Device.new(port: port) }
  let(:udp_device) { LogStashLogger::Device.new(type: :udp, port: port) }
  let(:tcp_device) { LogStashLogger::Device.new(type: :tcp, port: port) }
  let(:ssl_tcp_device) { LogStashLogger::Device.new(type: :tcp, port: port, ssl_enable: true) }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-logger-0.5.0 spec/spec_helper.rb