proxy_pac_rb 0.5.7 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c931688e2a83602e1fddd5ae9392932d87b78fd9
4
- data.tar.gz: 6cdaa73ca1615fd2615c08fb884770d99a52d63e
3
+ metadata.gz: de39ce4d9ce02bf48628e304ce64bd2ff1ef67fa
4
+ data.tar.gz: a50ef8b2be723a9ed22230be24a308044b679815
5
5
  SHA512:
6
- metadata.gz: dbfa654f164948f27fe1bc01f028c84f58ff0ec0dd6afe565533325cc4d482af6b8ec1bb0138b3bffa0c084ab8b42286b2ac3b4b47c3d0875086ab4d1ac08ea8
7
- data.tar.gz: 682817b528c3ddbd54a34482e51203c3126fa3a851117443095b19b51bf94bf4155bfd6da8241a4e28e70b29cbae836dadd8c6dd46b802961e498db4a13e13ac
6
+ metadata.gz: 434850e84feb3f3d688697a40310a164ee6a96e29b7b0d4df759fb65690980b76d5b979f753b10d3e9298bf874a8316ec6a6a3303010f24ed4446212ce16b083
7
+ data.tar.gz: d3bba9a2761c30a466c2883d5ca2d647529174d427710ac540c9434d37bf3b4c0ac15d7a62022fab26b17fd37cb71c6aca868dfde968b9761931eede5d9db44f
data/Gemfile.lock CHANGED
@@ -22,7 +22,7 @@ GIT
22
22
  PATH
23
23
  remote: .
24
24
  specs:
25
- proxy_pac_rb (0.5.6)
25
+ proxy_pac_rb (0.5.8)
26
26
  activesupport (~> 4.1)
27
27
  addressable (~> 2.3.8)
28
28
  uglifier (~> 2.7.1)
@@ -54,8 +54,11 @@ module ProxyPacRb
54
54
  !resolve_host(host).blank?
55
55
  end
56
56
 
57
- def isInNet(host, pattern, mask)
58
- IPAddr.new(pattern).mask(mask).include? resolve_host(host)
57
+ def isInNet(host, base_ip, mask)
58
+ raise ArgumentError, "<base ip> needs to be defined" if base_ip.nil? || base_ip.empty?
59
+ raise ArgumentError, "<mask> needs to be defined" if mask.nil? || mask.empty?
60
+
61
+ IPAddr.new(base_ip).mask(mask).include? resolve_host(host)
59
62
  end
60
63
 
61
64
  def dnsResolve(host)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # ProxyPacRb
3
3
  module ProxyPacRb
4
- VERSION = '0.5.7'
4
+ VERSION = '0.5.8'
5
5
  end
@@ -122,6 +122,26 @@ RSpec.describe ProxyPacRb::Environment do
122
122
  let(:result) { environment.isInNet('', '93.0.0.0', '255.0.0.0') }
123
123
  it { expect(result).to eq false }
124
124
  end
125
+
126
+ context 'when base ip is empty string' do
127
+ let(:result) { environment.isInNet('127.0.0.1', '', '255.0.0.0') }
128
+ it { expect{ result }.to raise_error ArgumentError }
129
+ end
130
+
131
+ context 'when base ip is nil' do
132
+ let(:result) { environment.isInNet('127.0.0.1', nil, '255.0.0.0') }
133
+ it { expect{ result }.to raise_error ArgumentError }
134
+ end
135
+
136
+ context 'when mask is empty string ""' do
137
+ let(:result) { environment.isInNet('127.0.0.1', '93.0.0.0', '') }
138
+ it { expect{ result }.to raise_error ArgumentError }
139
+ end
140
+
141
+ context 'when mask is nil' do
142
+ let(:result) { environment.isInNet('127.0.0.1', '93.0.0.0', nil) }
143
+ it { expect{ result }.to raise_error ArgumentError }
144
+ end
125
145
  end
126
146
 
127
147
  describe '#dnsResolve' 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.7
4
+ version: 0.5.8
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-04-22 00:00:00.000000000 Z
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable