Sha256: a0ba85138ca3e5dc0d455a9df6d1f9b213562bbae07fdfbbe552a216ab03d62e

Contents?: true

Size: 621 Bytes

Versions: 1

Compression:

Stored size: 621 Bytes

Contents

require 'spec_helper'

describe Wordnik::LoadBalancer do
	before(:each) do
		@hosts = ["alpha","beta","gamma","delta"].map{|x| "#{x}.wordnik.com"}
	end

	describe "Load Balancer" do
    it "allows creation with a list of hosts" do
     	lb = Wordnik::LoadBalancer.new(@hosts)
     	h = lb.host
     	@hosts.should include(h)
    end

    it "returns different (random) hosts" do
    	lb = Wordnik::LoadBalancer.new(@hosts)
    	counts = Hash.new(0)
    	1.upto(1000) do
    		h = lb.host
    		counts[h] += 1
    	end
    	@hosts.each {|host| counts[host].should > 10}
    end

    it "should not leak memory"

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wordnik-4.08 spec/load_balancer_spec.rb