rspec-proxypac 0.1.0
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 +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +50 -0
- data/Rakefile +16 -0
- data/lib/rspec_proxypac.rb +6 -0
- data/lib/rspec_proxypac/find_proxy.rb +31 -0
- data/lib/rspec_proxypac/util.rb +6 -0
- data/lib/rspec_proxypac/version.rb +4 -0
- data/rspec-proxypac.gemspec +30 -0
- data/spec/example.pac +4 -0
- data/spec/rspec_proxypac/find_proxy_spec.rb +14 -0
- data/spec/rspec_proxypac/rspec_proxypac_spec.rb +9 -0
- data/spec/rspec_proxypac/util_spec.rb +4 -0
- data/spec/spec_helper.rb +16 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1909bb1dce3b543dc6f31549e61fe241640b0dad
|
4
|
+
data.tar.gz: 3599e7c798eef68118ddec9158bf99bd3a237fe0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b77e69bd49d0e3d8160162d746abc82eccd25aa550429780cfcfbd44bd7c3ac6aff0b00ecc876a271ad314fbeda9b083383aa23b6552395dff1357e0463a85e5
|
7
|
+
data.tar.gz: 19422d8c4b9ceff0db7091fd2069312470d0b2958a3742539f7c4edcf11c907ecf79837af7777321d41c53dfa152107c8c5a2d0515d5d268a237e9fc15394e21
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 OTA Hiroshi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# rspec-ssltls [](https://travis-ci.org/otahi/rspec-proxypac)[](https://coveralls.io/r/otahi/rspec-proxypac?branch=master)[](https://codeclimate.com/github/otahi/rspec-proxypac)[](http://badge.fury.io/rb/rspec-proxypac)
|
2
|
+
|
3
|
+
|
4
|
+
Rspec-proxypac is an rspec plugin for easy proxy.pac testing.
|
5
|
+
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
RSpec-proxypac is best described by example. First, require `rspec_proxypac` in your `spec_helper.rb`:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
# spec/spec_helper.rb
|
12
|
+
require 'rspec_proxypac'
|
13
|
+
```
|
14
|
+
|
15
|
+
Then, create a spec like this:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'spec_helper'
|
19
|
+
|
20
|
+
describe 'http://proxy.example.org/proxy.pac' do
|
21
|
+
it do
|
22
|
+
is_expected.to find_proxy('http://proxy.example.org:3128/')
|
23
|
+
.for('http://www.example.com/')
|
24
|
+
end
|
25
|
+
it { is_expected.to find_proxy('DIRECT').for('http://www.example.org') }
|
26
|
+
end
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
|
30
|
+
Add this line to your application's Gemfile:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
gem 'rspec-proxypac'
|
34
|
+
```
|
35
|
+
|
36
|
+
And then execute:
|
37
|
+
|
38
|
+
$ bundle
|
39
|
+
|
40
|
+
Or install it yourself as:
|
41
|
+
|
42
|
+
$ gem install rspec-proxypac
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
1. Fork it ( https://github.com/otahi/rspec-proxypac/fork )
|
47
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
48
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
49
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
50
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'rubocop/rake_task'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
require 'coveralls/rake/task'
|
5
|
+
|
6
|
+
task default: [:spec, 'coveralls:push', :rubocop]
|
7
|
+
|
8
|
+
Coveralls::RakeTask.new
|
9
|
+
|
10
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
11
|
+
t.pattern = 'spec/**/*_spec.rb'
|
12
|
+
end
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
15
|
+
task.patterns = %w(lib/**/*.rb spec/**/*.rb)
|
16
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rspec_proxypac'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
RSpec::Matchers.define :find_proxy do |expected|
|
5
|
+
match do |pacfile|
|
6
|
+
pac = PAC.load(pacfile)
|
7
|
+
@result_string = pac.find(@target_url)
|
8
|
+
@result_string == expected
|
9
|
+
end
|
10
|
+
|
11
|
+
chain :for do |url|
|
12
|
+
@target_url = url
|
13
|
+
@chain_string = "for #{url}"
|
14
|
+
end
|
15
|
+
|
16
|
+
description do
|
17
|
+
"should find proxy '#{@result_string}' #{@chain_string}"
|
18
|
+
end
|
19
|
+
|
20
|
+
failure_message do
|
21
|
+
s = "expected to find proxy '#{@chain_string}', but did not."
|
22
|
+
s + "\n#{@result_string}"
|
23
|
+
end
|
24
|
+
|
25
|
+
failure_message_when_negated do
|
26
|
+
s = "expected not to find proxy '#{@chain_string}', but did."
|
27
|
+
s + "\n'#{@result_string}'"
|
28
|
+
.sub(/(expected:)/, 'expected not:')
|
29
|
+
.sub(/(actual:)/, 'actual: ')
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rspec_proxypac/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'rspec-proxypac'
|
8
|
+
spec.version = RspecProxypac::VERSION
|
9
|
+
spec.authors = ['Hiroshi Ota']
|
10
|
+
spec.email = ['otahi.pub@gmail.com']
|
11
|
+
spec.summary = 'Easily test your proxy.pac with RSpec.'
|
12
|
+
spec.description =
|
13
|
+
'Rspec-proxypac is an rspec plugin for easy proxy.pac testing.'
|
14
|
+
spec.homepage = 'https://github.com/otahi/rspec-proxypac'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
spec.add_dependency 'rspec', '>= 2.9'
|
22
|
+
spec.add_dependency 'pac', '~> 1.0.0'
|
23
|
+
spec.add_dependency 'therubyracer', '~> 0.12.1'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '>= 1.6'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
27
|
+
spec.add_development_dependency 'rubocop', '0.24.1'
|
28
|
+
spec.add_development_dependency 'coveralls', '~> 0.7'
|
29
|
+
spec.add_development_dependency 'byebug', '~> 3.4.0'
|
30
|
+
end
|
data/spec/example.pac
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'rspec-proxypac matchers' do
|
4
|
+
describe '#find_proxy' do
|
5
|
+
describe 'spec/example.pac' do
|
6
|
+
let(:subject) { 'spec/example.pac' }
|
7
|
+
it do
|
8
|
+
is_expected.to find_proxy('PROXY proxy.example.org:3128')
|
9
|
+
.for('http://www.example.com/')
|
10
|
+
end
|
11
|
+
it { is_expected.to find_proxy('DIRECT').for('http://www.example.org/') }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
Coveralls::SimpleCov::Formatter
|
9
|
+
]
|
10
|
+
SimpleCov.start do
|
11
|
+
add_filter '.bundle/'
|
12
|
+
end
|
13
|
+
|
14
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
15
|
+
|
16
|
+
require 'rspec_proxypac'
|
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-proxypac
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hiroshi Ota
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pac
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: therubyracer
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.12.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.12.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.24.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.24.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.7'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.7'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: byebug
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 3.4.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.4.0
|
125
|
+
description: Rspec-proxypac is an rspec plugin for easy proxy.pac testing.
|
126
|
+
email:
|
127
|
+
- otahi.pub@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- Gemfile
|
134
|
+
- LICENSE.txt
|
135
|
+
- README.md
|
136
|
+
- Rakefile
|
137
|
+
- lib/rspec_proxypac.rb
|
138
|
+
- lib/rspec_proxypac/find_proxy.rb
|
139
|
+
- lib/rspec_proxypac/util.rb
|
140
|
+
- lib/rspec_proxypac/version.rb
|
141
|
+
- rspec-proxypac.gemspec
|
142
|
+
- spec/example.pac
|
143
|
+
- spec/rspec_proxypac/find_proxy_spec.rb
|
144
|
+
- spec/rspec_proxypac/rspec_proxypac_spec.rb
|
145
|
+
- spec/rspec_proxypac/util_spec.rb
|
146
|
+
- spec/spec_helper.rb
|
147
|
+
homepage: https://github.com/otahi/rspec-proxypac
|
148
|
+
licenses:
|
149
|
+
- MIT
|
150
|
+
metadata: {}
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
require_paths:
|
154
|
+
- lib
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 2.2.2
|
168
|
+
signing_key:
|
169
|
+
specification_version: 4
|
170
|
+
summary: Easily test your proxy.pac with RSpec.
|
171
|
+
test_files:
|
172
|
+
- spec/example.pac
|
173
|
+
- spec/rspec_proxypac/find_proxy_spec.rb
|
174
|
+
- spec/rspec_proxypac/rspec_proxypac_spec.rb
|
175
|
+
- spec/rspec_proxypac/util_spec.rb
|
176
|
+
- spec/spec_helper.rb
|