Sha256: 887f234e1ce546732ee0c7d3d25a8959951c7c858b8d36d5f65afb48caa159c7

Contents?: true

Size: 1009 Bytes

Versions: 3

Compression:

Stored size: 1009 Bytes

Contents

require 'spec_helper'

describe Shb::Client do

  it "does not cycle the user agent" do
    stub_request(:any, 'supremegolf.com')
    shb = Shb::Client.new
    shb.config.cycle_user_agent = false

    expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::AGENT_ALIASES[0]
    expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::AGENT_ALIASES[0]
    expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::AGENT_ALIASES[0]
  end

  it "cycles the user agent" do
    stub_request(:any, 'supremegolf.com')
    shb = Shb::Client.new
    shb.config.cycle_user_agent = true

    expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::AGENT_ALIASES[0]
    expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::AGENT_ALIASES[1]
    expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::AGENT_ALIASES[2]
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shb-0.0.4 spec/cycle_user_agent_spec.rb
shb-0.0.3 spec/cycle_user_agent_spec.rb
shb-0.0.2 spec/cycle_user_agent_spec.rb