Sha256: 0795111545e381c7b382226a98f81f2b3b7dec1a444465644e7a295c04805f34

Contents?: true

Size: 560 Bytes

Versions: 5

Compression:

Stored size: 560 Bytes

Contents

RSpec.describe Dryad::Cluster::RoundRobin do
  before do
    @services = Array.new(10) {|index| index + 1}
    @round_robin = Dryad::Cluster::RoundRobin.new
  end

  it "set services and get service correctly" do
    @round_robin.set_services(@services)
    10.times do |i|
      expect(@round_robin.service).to eq(@services[(i + 1) % 10])
    end
  end

  it "raises no services error when services are empty" do
    begin
      @round_robin.service
    rescue StandardError => e
      expect(e.class).to eq(Dryad::Cluster::NoServicesError)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dryad-0.2.5 dryad-cluster/spec/dryad/cluster/round_robin_spec.rb
dryad-0.2.3 dryad-cluster/spec/dryad/cluster/round_robin_spec.rb
dryad-0.2.1 dryad-cluster/spec/dryad/cluster/round_robin_spec.rb
dryad-0.2.0 dryad-cluster/spec/dryad/cluster/round_robin_spec.rb
dryad-0.1.1 dryad-cluster/spec/dryad/cluster/round_robin_spec.rb