Sha256: ec3ccc60f0f40e72c8b8add042d967d326860228e31ca301fb4723d3878d3363

Contents?: true

Size: 845 Bytes

Versions: 2

Compression:

Stored size: 845 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
    expect(subject.proxy(name, site)).to eq(proxies.first)
  end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
PageRankr-4.6.1 spec/proxy_services/round_robin_spec.rb
PageRankr-4.6.0 spec/proxy_services/round_robin_spec.rb