proxy_pac_rb 0.5.9 → 0.5.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cacbc28ba979ad53822a1cc72ca2428617e8b3e3
4
- data.tar.gz: f7d8f485f0792af064f98e363499ab2c0a253f96
3
+ metadata.gz: c8947d531f4f1dad52295ebfce27b5fff8a77393
4
+ data.tar.gz: 346759a3aef384fba2aec24b023b95c301bf0128
5
5
  SHA512:
6
- metadata.gz: f1764e03b66466b5ef36d77d56063c5cf4b57eb4a3f4a421faffc4754b8d925153090d1250a4114a3dcdcbf6282b5d889f4cde709409d891937b54818ab0646b
7
- data.tar.gz: 4cc50d8aa8ee81f4aaada09783f5b6c311dd01633edf2c165c311b479b7bcda90969ddf116dc4146dcf25cc24745685c366c105884a3dac3651e267733e184e2
6
+ metadata.gz: 688dfae547bd7239087380d8b6f00eb076eebd2fc2c1db72f5e5785739515fd30afbc3f78fdf5c8c9fc89e0903ec886a0f37212063c441ad64350b89115d23a1
7
+ data.tar.gz: 46b1e53ce947b583a8bab4aa7023e047c0fd73fcffcf52b0a77009195ee4cd9687d9a3805797275b289193d0b43a69c6d862135d6282a3b7bae708ec4be73889
data/Gemfile.lock CHANGED
@@ -22,7 +22,7 @@ GIT
22
22
  PATH
23
23
  remote: .
24
24
  specs:
25
- proxy_pac_rb (0.5.8)
25
+ proxy_pac_rb (0.5.9)
26
26
  activesupport (~> 4.1)
27
27
  addressable (~> 2.3.8)
28
28
  uglifier (~> 2.7.1)
@@ -3,13 +3,7 @@ module ProxyPacRb
3
3
  # Helpers for proxy.pac tests
4
4
  module Helpers
5
5
  def proxy_pac
6
- source = if subject.nil? || Addressable::URI.parse(subject).host || /FindProxyForURL/ === subject
7
- subject
8
- else
9
- File.join(root_path, subject)
10
- end
11
-
12
- file = ProxyPacRb::ProxyPacFile.new(source: source)
6
+ file = ProxyPacRb::ProxyPacFile.new(source: _proxy_pac_source)
13
7
 
14
8
  _proxy_pac_loader.load(file)
15
9
  _proxy_pac_linter.lint(file)
@@ -32,6 +26,20 @@ module ProxyPacRb
32
26
 
33
27
  private
34
28
 
29
+ def _proxy_pac_source
30
+ url_host = begin
31
+ Addressable::URI.parse(subject).host
32
+ rescue
33
+ nil
34
+ end
35
+
36
+ if subject.nil? || /FindProxyForURL/ === subject || url_host
37
+ subject
38
+ else
39
+ File.join(root_path, subject)
40
+ end
41
+ end
42
+
35
43
  def _environment
36
44
  Environment.new(time: time, client_ip: client_ip)
37
45
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # ProxyPacRb
3
3
  module ProxyPacRb
4
- VERSION = '0.5.9'
4
+ VERSION = '0.5.10'
5
5
  end
@@ -12,6 +12,21 @@ RSpec.describe 'Validity', type: :proxy_pac do
12
12
 
13
13
  context 'when is valid' do
14
14
  it { expect(proxy_pac).to be_valid }
15
+
16
+ context 'although it makes URI to raise invalid url error' do
17
+ subject do
18
+ <<-EOS.strip_heredoc.chomp
19
+ function FindProxyForURL(url, host) {
20
+ // comment
21
+ if ( dnsDomainIs ( host, "example.org") ) {
22
+ return "PROXY 10.0.0.0:8080";
23
+ }
24
+ }
25
+ EOS
26
+ end
27
+
28
+ it { expect(proxy_pac).to be_valid }
29
+ end
15
30
  end
16
31
 
17
32
  context 'when is not valid' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_pac_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.5.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Günnewig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-05 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable