Sha256: a6ac2b7e05a9495ca5f8f9765ce1427c86f2b069d79d5d5c27fd4a1cc249150d

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

require 'bundler/setup'
require 'rspec'
require 'fwd'

module Fwd::TestHelper

  def with_em
    EM.run do
      begin
        yield
      ensure
        EM.stop
      end
    end
  end

  def root
    @_root ||= Pathname.new File.expand_path("../../tmp", __FILE__)
  end

  def core
    @_core ||= Fwd.new \
      path: root,
      flush_rate: 20,
      buffer_limit: 2048,
      forward: ["tcp://127.0.0.1:7291", "tcp://127.0.0.1:7292"]
  end

  def timer
    @_timer ||= mock("Timer", cancel: true)
  end

end

RSpec.configure do |c|
  c.include(Fwd::TestHelper)
  c.before(:suite) do
    Fwd.logger = Logger.new("/dev/null")
  end
  c.before(:each) do
    FileUtils.rm_rf root.to_s
    EM.stub add_periodic_timer: timer
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fwd-0.3.3 spec/spec_helper.rb