Sha256: c1f700dfe90d3d6f377dcdf6986a7fb7af67fd5887d9f32cd7e4e6c7eb25d735

Contents?: true

Size: 1.41 KB

Versions: 16

Compression:

Stored size: 1.41 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe ProxyPac::PacResult do
  context '#initialize' do
    it 'requires a pac parser result' do
      ProxyPac::PacResult.new('"DIRECT"')
    end

    it 'handles a empty string' do
      expect {
        ProxyPac::PacResult.new('')
      }.not_to raise_error
    end
  end

  context '#verbatim_content' do
    it 'returns the verbatim content' do
      result = ProxyPac::PacResult.new('"DIRECT"')
      expect(result.verbatim_content).to eq('"DIRECT"')
    end
  end

  context '#proxy' do
    it 'extracts proxy-hostname from string' do
      result = ProxyPac::PacResult.new('"PROXY 127.0.0.1:8080"')
      expect(result.proxy).to eq('127.0.0.1')
    end

    it 'extracts proxy-hostname from short string' do
      result = ProxyPac::PacResult.new('"PROXY 127.0.0.1"')
      expect(result.proxy).to eq('127.0.0.1')
    end
  end

  context '#proxy_port' do
    it 'extracts proxy-port from string' do
      result = ProxyPac::PacResult.new('"PROXY 127.0.0.1:8080"')
      expect(result.proxy_port).to eq('8080')
    end
  end

  context '#request_type' do
    it 'extracts request type from string' do
      result = ProxyPac::PacResult.new('"PROXY 127.0.0.1:8080"')
      expect(result.request_type).to eq('PROXY')
    end

    it 'extracts request type from short string' do
      result = ProxyPac::PacResult.new('"DIRECT"')
      expect(result.request_type).to eq('DIRECT')
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
local_pac-0.10.2 spec/proxy_pac/pac_result_spec.rb
local_pac-0.10.1 spec/proxy_pac/pac_result_spec.rb
local_pac-0.10.0 spec/proxy_pac/pac_result_spec.rb
local_pac-0.9.0 spec/proxy_pac/pac_result_spec.rb
local_pac-0.7.0 spec/proxy_pac/pac_result_spec.rb
local_pac-0.6.3 spec/proxy_pac/pac_result_spec.rb
local_pac-0.6.2 spec/proxy_pac/pac_result_spec.rb
local_pac-0.6.1 spec/proxy_pac/pac_result_spec.rb
local_pac-0.5.0 spec/proxy_pac/pac_result_spec.rb
local_pac-0.4.0 spec/proxy_pac/pac_result_spec.rb
local_pac-0.3.0 spec/proxy_pac/pac_result_spec.rb
local_pac-0.2.3 spec/proxy_pac/pac_result_spec.rb
local_pac-0.2.2 spec/proxy_pac/pac_result_spec.rb
local_pac-0.2.1 spec/proxy_pac/pac_result_spec.rb
local_pac-0.2.0 spec/proxy_pac/pac_result_spec.rb
local_pac-0.1.13 spec/proxy_pac/pac_result_spec.rb