Sha256: 07636c633fc9619615b8108d0a9265ef02ca8bba3c8f6aa556c1a9ecc4f09024

Contents?: true

Size: 991 Bytes

Versions: 5

Compression:

Stored size: 991 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::USER_AGENT
    expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::USER_AGENT
    expect(shb.get('/').request.options[:headers]['User-Agent']).to eq Shb::AbstractClient::USER_AGENT
  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

5 entries across 5 versions & 1 rubygems

Version Path
shb-0.1.4 spec/user_agent_spec.rb
shb-0.1.3 spec/user_agent_spec.rb
shb-0.1.2 spec/user_agent_spec.rb
shb-0.1.1 spec/user_agent_spec.rb
shb-0.1.0 spec/user_agent_spec.rb