Sha256: dd42c4105efcb1ed42e1775de30003ef8680fe9ee5717981f648b9109c70cad6

Contents?: true

Size: 979 Bytes

Versions: 6

Compression:

Stored size: 979 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe File do
  let(:simple) do 
    <<-EOS.strip_heredoc
      function FindProxyForURL(url, host) {
        return "DIRECT";
      }
    EOS
  end

  let(:client_ip_pac) do 
    <<-EOS.strip_heredoc
      function FindProxyForURL(url, host) {
        if ( MyIpAddress() == '127.0.0.2' ) {
          return "DIRECT";
        } else {
          return "PROXY localhost:8080";
        }
      }
    EOS
  end

  let(:time_pac) do 
    <<-EOS.strip_heredoc
      function FindProxyForURL(url, host) {
        if ( timeRange(8, 18) ) {
          return "PROXY localhost:8080";
        } else {
          return "DIRECT";
        }
      }
    EOS
  end

  context '#find' do
    it 'returns result of proxy.pac' do
      javascript = double('javascript')
      expect(javascript).to receive(:call).with("FindProxyForURL", "http://localhost", "localhost")

      ProxyPacRb::File.new(javascript).find("http://localhost")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
proxy_pac_rb-0.2.4 spec/file_spec.rb
proxy_pac_rb-0.2.3 spec/file_spec.rb
proxy_pac_rb-0.2.2 spec/file_spec.rb
proxy_pac_rb-0.2.1 spec/file_spec.rb
proxy_pac_rb-0.2.0 spec/file_spec.rb
proxy_pac_rb-0.0.3 spec/file_spec.rb