Sha256: 3b7d483ee3cc78bc7441534b0bb764a9a415482d94a6e12f27596b2877d3cbc3

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

require "pac/test_helper"

describe PAC do
  describe "read" do
    before do
      @path = File.expand_path("../files/sample.pac", __FILE__)
    end

    it "should load a file from a path" do
      pac = PAC.read(@path)
      pac.wont_be_nil
    end

    it "should return DIRECT for a url" do
      pac = PAC.read(@path)
      pac.find("http://localhost").must_equal "DIRECT"
    end
  end

  describe "source" do
    before do
      @source = <<-JS
        function FindProxyForURL(url, host) {
          return "DIRECT";
        }
      JS
    end

    it "should load source" do
      pac = PAC.source(@source)
      pac.wont_be_nil
    end

    it "should return DIRECT for a url" do
      pac = PAC.source(@source)
      pac.find("http://localhost").must_equal "DIRECT"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pac-1.0.0 test/pac_test.rb