Sha256: 6ad265d582df9a4bc81da1449106079620e4a6315e89ee50bb3cd67b0abee089

Contents?: true

Size: 761 Bytes

Versions: 8

Compression:

Stored size: 761 Bytes

Contents

require 'spec_helper'

describe Shb::Client do

  it "does not use cookies" do
    stub_request(:any, 'supremegolf.com').to_return {|r| 
      { headers: {'Set-Cookie' => 'cookie123'} }
    }
    shb = Shb::Client.new
    shb.config.use_cookies = false

    expect(shb.get('/').request.options[:headers]['Cookie']).to be_nil
    expect(shb.get('/').request.options[:headers]['Cookie']).to be_nil
  end

  it "uses cookies" do
    stub_request(:any, 'supremegolf.com').to_return {|r| 
      { headers: {'Set-Cookie' => 'cookie123'} }
    }
    shb = Shb::Client.new
    shb.config.use_cookies = true

    expect(shb.get('/').request.options[:headers]['Cookie']).to be_nil
    expect(shb.get('/').request.options[:headers]['Cookie']).to eq 'cookie123'
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shb-0.1.4 spec/user_cookies_spec.rb
shb-0.1.3 spec/user_cookies_spec.rb
shb-0.1.2 spec/user_cookies_spec.rb
shb-0.1.1 spec/user_cookies_spec.rb
shb-0.1.0 spec/user_cookies_spec.rb
shb-0.0.4 spec/user_cookies_spec.rb
shb-0.0.3 spec/user_cookies_spec.rb
shb-0.0.2 spec/user_cookies_spec.rb