Sha256: 4949b642809652fb6be66aa4b0b6f9a0ccfd58d48c6cf1d8f7106f5ccc0667bc

Contents?: true

Size: 829 Bytes

Versions: 10

Compression:

Stored size: 829 Bytes

Contents

require 'spec_helper'

describe PageRankr::ProxyServices::RoundRobin do
  let(:proxies) do
    [
      "user:password@192.168.1.1:50501",
      "bob:smith@127.0.0.1:3000"
    ]
  end
  let(:site){PageRankr::Site("http://www.google.com")}
  let(:name){:ranks_google}
  subject{PageRankr::ProxyServices::RoundRobin.new(proxies)}

  it{should respond_to(:proxy).with(2).arguments}

  it "should return the first proxy on the first call" do
    subject.proxy(name, site).should == proxies.first
  end

  it "should return the second proxy on the second call" do
    subject.proxy(name, site)
    subject.proxy(name, site).should == proxies.last
  end

  it "should return the first proxy on the third call" do
    subject.proxy(name, site)
    subject.proxy(name, site)
    subject.proxy(name, site).should == proxies.first
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
PageRankr-4.4.1 spec/proxy_services/round_robin_spec.rb
PageRankr-4.4.0 spec/proxy_services/round_robin_spec.rb
PageRankr-4.3.0 spec/proxy_services/round_robin_spec.rb
PageRankr-4.2.1 spec/proxy_services/round_robin_spec.rb
PageRankr-4.2.0 spec/proxy_services/round_robin_spec.rb
PageRankr-4.1.1 spec/proxy_services/round_robin_spec.rb
PageRankr-4.1.0 spec/proxy_services/round_robin_spec.rb
PageRankr-4.0.0 spec/proxy_services/round_robin_spec.rb
PageRankr-3.2.1 spec/proxy_services/round_robin_spec.rb
PageRankr-3.2.0 spec/proxy_services/round_robin_spec.rb