Sha256: 078e71174560453559171f805c159bfa902be14597575064fb7f88cafc0d35c5

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

ENV['RACK_ENV'] = 'test'

require 'rspec'
require 'rack/test'
require 'big_brother'
require "socket"

Dir.glob("#{File.expand_path('support', File.dirname(__FILE__))}/**/*.rb").each { |f| require f }

RSpec.configure do |config|
  config.expect_with :rspec
  config.include Rack::Test::Methods

  config.around(:each) do |spec|
    ipvs = BigBrother.ipvs
    @recording_executor = RecordingExecutor.new
    BigBrother.ipvs = BigBrother::IPVS.new(@recording_executor)
    spec.run
    BigBrother.ipvs = ipvs
  end

  config.before(:each) do
    BigBrother.clusters.replace({})
    FileUtils.rm_rf(BigBrother.config_dir)
    BigBrother.logger = NullLogger.new
  end
end

def run_in_reactor
  around(:each) do |spec|
    EM.synchrony do
      spec.run
      EM.stop
    end
  end
end

def with_litmus_server(ip, port, health)
  around(:each) do |spec|
    server = StubServer.new(<<-HTTP, 0.25, port, ip)
HTTP/1.0 200 OK
Connection: close

Health: #{health}
HTTP
    spec.run
    server.stop
  end
end

def public_ip_address
  local_ip = UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last}
end

BigBrother.config_dir = "/tmp/big_brother"

TEST_CONFIG = File.expand_path('support/example_config.yml', File.dirname(__FILE__))

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
big_brother-0.3.1 spec/spec_helper.rb
big_brother-0.3.0 spec/spec_helper.rb
big_brother-0.2.1 spec/spec_helper.rb
big_brother-0.2.0 spec/spec_helper.rb
big_brother-0.1.0 spec/spec_helper.rb