puffing-billy 2.3.0 → 3.0.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 +4 -4
- data/.github/workflows/ci.yml +27 -0
- data/CHANGELOG.md +17 -0
- data/README.md +115 -101
- data/lib/billy/browsers/watir.rb +4 -2
- data/lib/billy/config.rb +2 -1
- data/lib/billy/handlers/proxy_handler.rb +4 -0
- data/lib/billy/proxy.rb +1 -1
- data/lib/billy/ssl/certificate_helpers.rb +1 -1
- data/lib/billy/version.rb +1 -1
- data/puffing-billy.gemspec +6 -4
- data/spec/lib/billy/handlers/proxy_handler_spec.rb +9 -5
- data/spec/lib/proxy_spec.rb +2 -2
- metadata +30 -17
- data/.travis.yml +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1955fb7348660b0f353200d6280598a526b86b78407165fb294faed839157eb5
|
4
|
+
data.tar.gz: 06db7eee54aa9cb21b876111695b399cf1073211d5268221cf5ed1ad36d044a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f397b5d7889e2e233336c4f35ce6cef157a7f86c64bd8d812ccb7700cc4bd91a48ff9695f3d14a29e696c44a3192c47eeba11e80f77c8b2391238a12dd15813
|
7
|
+
data.tar.gz: 5f46e1fedad3a942b30a8667338073c8e3cbc166054f6acde5f2d5820734b603188dc247d845850e23e95762726cc0de2c657ced3d5c3ce4f8e9e02206e014df
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
2
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
3
|
+
|
4
|
+
name: CI
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master ]
|
8
|
+
pull_request:
|
9
|
+
branches: [ master ]
|
10
|
+
jobs:
|
11
|
+
test:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
ruby-version: ['2.6', '2.7', '3.0', '3.1']
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Set up Ruby
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
bundler-cache: true
|
25
|
+
rubygems: latest
|
26
|
+
- name: Run tests
|
27
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
v3.0.0, 2022-02-15
|
2
|
+
-------------------
|
3
|
+
* Add support for Ruby 2.7+, remove support for Ruby 2.4 and 2.5
|
4
|
+
|
5
|
+
v2.4.1, 2021-01-05
|
6
|
+
-------------------
|
7
|
+
* Rescue Errno::ECONNRESET in shutdown phase [#307](https://github.com/oesmith/puffing-billy/pull/307)
|
8
|
+
|
9
|
+
v2.4.0, 2020-08-26
|
10
|
+
-------------------
|
11
|
+
* Make verify_peer configurable and default it to false [#294](https://github.com/oesmith/puffing-billy/pull/294)
|
12
|
+
* Include pid in names of temporary files [#290](https://github.com/oesmith/puffing-billy/pull/290)
|
13
|
+
|
14
|
+
v2.3.1, 2020-03-19
|
15
|
+
-------------------
|
16
|
+
* Update min 'faraday' gem version required [#285](https://github.com/oesmith/puffing-billy/pull/285)
|
17
|
+
|
1
18
|
v2.3.0, 2019-12-26
|
2
19
|
-------------------
|
3
20
|
* Add `cache_whitelist` config option [#279](https://github.com/oesmith/puffing-billy/pull/279)
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Puffing Billy [](https://badge.fury.io/rb/puffing-billy)
|
1
|
+
# Puffing Billy [](https://badge.fury.io/rb/puffing-billy) 
|
2
2
|
|
3
3
|
A rewriting web proxy for testing interactions between your browser and
|
4
4
|
external sites. Works with ruby + rspec.
|
@@ -14,9 +14,9 @@ Billy spawns an EventMachine-based proxy server, which it uses to intercept
|
|
14
14
|
requests sent by your browser. It has a simple API for configuring which
|
15
15
|
requests need stubbing and what they should return.
|
16
16
|
|
17
|
-
Billy lets you test against known, repeatable data.
|
17
|
+
Billy lets you test against known, repeatable data. It also allows you to
|
18
18
|
test for failure cases. Does your twitter (or facebook/google/etc)
|
19
|
-
integration degrade gracefully when the API starts returning 500s?
|
19
|
+
integration degrade gracefully when the API starts returning 500s? Well now
|
20
20
|
you can test it!
|
21
21
|
|
22
22
|
```ruby
|
@@ -32,21 +32,25 @@ You can also record HTTP interactions and replay them later. See
|
|
32
32
|
|
33
33
|
## Installation
|
34
34
|
|
35
|
-
Add this line to your application's Gemfile
|
35
|
+
Add this line to your application's `Gemfile`:
|
36
36
|
|
37
|
-
|
37
|
+
```ruby
|
38
|
+
gem 'puffing-billy', group: :test
|
39
|
+
```
|
38
40
|
|
39
41
|
And then execute:
|
40
42
|
|
41
|
-
|
43
|
+
```sh
|
44
|
+
$ bundle
|
45
|
+
```
|
42
46
|
|
43
47
|
Or install it yourself as:
|
44
48
|
|
45
|
-
|
46
|
-
|
47
|
-
|
49
|
+
```sh
|
50
|
+
$ gem install puffing-billy
|
51
|
+
```
|
48
52
|
|
49
|
-
|
53
|
+
## Setup for Capybara
|
50
54
|
|
51
55
|
In your `rails_helper.rb`:
|
52
56
|
|
@@ -68,7 +72,7 @@ Capybara.javascript_driver = :selenium_billy # Uses Firefox
|
|
68
72
|
headless specs when using puffing-billy for other local rack apps.
|
69
73
|
See [this phantomjs issue](https://github.com/ariya/phantomjs/issues/11342) for any updates.
|
70
74
|
|
71
|
-
|
75
|
+
## Setup for Watir
|
72
76
|
|
73
77
|
In your `rails_helper.rb`:
|
74
78
|
|
@@ -81,7 +85,82 @@ require 'billy/watir/rspec'
|
|
81
85
|
# @browser = Billy::Browsers::Watir.new = :phantomjs
|
82
86
|
```
|
83
87
|
|
84
|
-
|
88
|
+
## Setup for Cucumber
|
89
|
+
|
90
|
+
An example feature:
|
91
|
+
|
92
|
+
```
|
93
|
+
Feature: Stubbing via billy
|
94
|
+
|
95
|
+
@javascript @billy
|
96
|
+
Scenario: Test billy
|
97
|
+
And a stub for google
|
98
|
+
```
|
99
|
+
|
100
|
+
### Setup for Cucumber + Capybara
|
101
|
+
|
102
|
+
In your `features/support/env.rb`:
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
require 'billy/capybara/cucumber'
|
106
|
+
|
107
|
+
After do
|
108
|
+
Capybara.use_default_driver
|
109
|
+
end
|
110
|
+
```
|
111
|
+
|
112
|
+
And in steps:
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
Before('@billy') do
|
116
|
+
Capybara.current_driver = :poltergeist_billy
|
117
|
+
end
|
118
|
+
|
119
|
+
And /^a stub for google$/ do
|
120
|
+
proxy.stub('http://www.google.com/').and_return(text: "I'm not Google!")
|
121
|
+
visit 'http://www.google.com/'
|
122
|
+
expect(page).to have_content("I'm not Google!")
|
123
|
+
end
|
124
|
+
```
|
125
|
+
|
126
|
+
It's good practice to reset the driver after each scenario, so having an
|
127
|
+
`@billy` tag switches the drivers on for a given scenario. Also note that
|
128
|
+
stubs are reset after each step, so any usage of a stub should be in the
|
129
|
+
same step that it was created in.
|
130
|
+
|
131
|
+
### Setup for Cucumber + Watir
|
132
|
+
|
133
|
+
In your `features/support/env.rb`:
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
require 'billy/watir/cucumber'
|
137
|
+
|
138
|
+
After do
|
139
|
+
@browser.close
|
140
|
+
end
|
141
|
+
```
|
142
|
+
|
143
|
+
And in steps:
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
Before('@billy') do
|
147
|
+
@browser = Billy::Browsers::Watir.new :firefox
|
148
|
+
end
|
149
|
+
|
150
|
+
And /^a stub for google$/ do
|
151
|
+
proxy.stub('http://www.google.com/').and_return(text: "I'm not Google!")
|
152
|
+
@browser.goto 'http://www.google.com/'
|
153
|
+
expect(@browser.text).to eq("I'm not Google!")
|
154
|
+
end
|
155
|
+
```
|
156
|
+
|
157
|
+
## Minitest Usage
|
158
|
+
|
159
|
+
Please see [this link](https://gist.github.com/sauy7/1b081266dd453a1b737b) for
|
160
|
+
details and report back to [Issue #49](https://github.com/oesmith/puffing-billy/issues/49)
|
161
|
+
if you get it fully working.
|
162
|
+
|
163
|
+
## Examples
|
85
164
|
|
86
165
|
```ruby
|
87
166
|
# Stub and return text, json, jsonp (or anything else)
|
@@ -161,81 +240,6 @@ proxy.unstub example_stub
|
|
161
240
|
proxy.reset
|
162
241
|
```
|
163
242
|
|
164
|
-
## Cucumber Usage
|
165
|
-
|
166
|
-
An example feature:
|
167
|
-
|
168
|
-
```
|
169
|
-
Feature: Stubbing via billy
|
170
|
-
|
171
|
-
@javascript @billy
|
172
|
-
Scenario: Test billy
|
173
|
-
And a stub for google
|
174
|
-
```
|
175
|
-
|
176
|
-
### Capybara
|
177
|
-
|
178
|
-
In your `features/support/env.rb`:
|
179
|
-
|
180
|
-
```ruby
|
181
|
-
require 'billy/capybara/cucumber'
|
182
|
-
|
183
|
-
After do
|
184
|
-
Capybara.use_default_driver
|
185
|
-
end
|
186
|
-
```
|
187
|
-
|
188
|
-
And in steps:
|
189
|
-
|
190
|
-
```ruby
|
191
|
-
Before('@billy') do
|
192
|
-
Capybara.current_driver = :poltergeist_billy
|
193
|
-
end
|
194
|
-
|
195
|
-
And /^a stub for google$/ do
|
196
|
-
proxy.stub('http://www.google.com/').and_return(text: "I'm not Google!")
|
197
|
-
visit 'http://www.google.com/'
|
198
|
-
expect(page).to have_content("I'm not Google!")
|
199
|
-
end
|
200
|
-
```
|
201
|
-
|
202
|
-
It's good practice to reset the driver after each scenario, so having an
|
203
|
-
`@billy` tag switches the drivers on for a given scenario. Also note that
|
204
|
-
stubs are reset after each step, so any usage of a stub should be in the
|
205
|
-
same step that it was created in.
|
206
|
-
|
207
|
-
### Watir
|
208
|
-
|
209
|
-
In your `features/support/env.rb`:
|
210
|
-
|
211
|
-
```ruby
|
212
|
-
require 'billy/watir/cucumber'
|
213
|
-
|
214
|
-
After do
|
215
|
-
@browser.close
|
216
|
-
end
|
217
|
-
```
|
218
|
-
|
219
|
-
And in steps:
|
220
|
-
|
221
|
-
```ruby
|
222
|
-
Before('@billy') do
|
223
|
-
@browser = Billy::Browsers::Watir.new :firefox
|
224
|
-
end
|
225
|
-
|
226
|
-
And /^a stub for google$/ do
|
227
|
-
proxy.stub('http://www.google.com/').and_return(text: "I'm not Google!")
|
228
|
-
@browser.goto 'http://www.google.com/'
|
229
|
-
expect(@browser.text).to eq("I'm not Google!")
|
230
|
-
end
|
231
|
-
```
|
232
|
-
|
233
|
-
## Minitest Usage
|
234
|
-
|
235
|
-
Please see [this link](https://gist.github.com/sauy7/1b081266dd453a1b737b) for
|
236
|
-
details and report back to [Issue #49](https://github.com/oesmith/puffing-billy/issues/49)
|
237
|
-
if you get it fully working.
|
238
|
-
|
239
243
|
## Caching
|
240
244
|
|
241
245
|
Requests routed through the external proxy are cached.
|
@@ -433,7 +437,7 @@ The handler column indicates how Puffing Billy handled your request:
|
|
433
437
|
- error: This request was not handled by a stub, and was not successfully handled
|
434
438
|
- cache: This response was handled by a previous cache
|
435
439
|
|
436
|
-
If your `status` is set to
|
440
|
+
If your `status` is set to `inflight` this request has not yet been handled fully. Either puffing billy crashed
|
437
441
|
internally on this request, or your test ended before it could complete successfully.
|
438
442
|
|
439
443
|
`c.cache_request_body_methods` is used to specify HTTP methods of requests that you would like to cache separately based on the contents of the request body. The default is ['post'].
|
@@ -539,20 +543,23 @@ end
|
|
539
543
|
If you want the cache for each test to be independent, i.e. have it's own directory where the cache files are stored, you can do so.
|
540
544
|
|
541
545
|
### in Cucumber
|
542
|
-
|
546
|
+
|
547
|
+
use a `Before` tag:
|
543
548
|
```rb
|
544
549
|
Before('@javascript') do |scenario, block|
|
545
550
|
Billy.configure do |c|
|
546
551
|
feature_name = scenario.feature.name.underscore
|
547
552
|
scenario_name = scenario.name.underscore
|
548
553
|
c.cache_path = "features/support/fixtures/req_cache/#{feature_name}/#{scenario_name}/"
|
549
|
-
|
554
|
+
FileUtils.mkdir_p(Billy.config.cache_path) unless File.exist?(Billy.config.cache_path)
|
550
555
|
end
|
551
556
|
end
|
552
557
|
```
|
553
558
|
|
554
559
|
### in Rspec
|
555
|
-
|
560
|
+
|
561
|
+
use a `before(:each)` block:
|
562
|
+
|
556
563
|
```rb
|
557
564
|
RSpec.configure do |config|
|
558
565
|
base_cache_path = Billy.config.cache_path
|
@@ -573,7 +580,6 @@ RSpec.configure do |config|
|
|
573
580
|
end
|
574
581
|
```
|
575
582
|
|
576
|
-
|
577
583
|
## Stub requests recording
|
578
584
|
|
579
585
|
If you want to record requests to stubbed URIs, set the following configuration option:
|
@@ -617,6 +623,7 @@ and tell it to ignore SSL certificate warnings. See
|
|
617
623
|
to see how Billy's default drivers are configured.
|
618
624
|
|
619
625
|
## Working with VCR and Webmock
|
626
|
+
|
620
627
|
If you use VCR and Webmock elsewhere in your specs, you may need to disable them
|
621
628
|
for your specs utilizing Puffing Billy. To do so, you can configure your `rails_helper.rb`
|
622
629
|
as shown below:
|
@@ -646,7 +653,7 @@ Note that this approach may cause unexpected behavior if your backend sends the
|
|
646
653
|
|
647
654
|
### Raising errors from stubs
|
648
655
|
|
649
|
-
By default
|
656
|
+
By default Puffing Billy suppresses errors from stub-blocks.
|
650
657
|
To make it raise errors instead, add this test initializers:
|
651
658
|
|
652
659
|
```ruby
|
@@ -733,17 +740,24 @@ the system store. So after a run of your the suite only one certificate will be
|
|
733
740
|
left over. If this is not enough you can handling the cleanup again with a
|
734
741
|
custom on-after hook.
|
735
742
|
|
736
|
-
|
743
|
+
### TLS hostname validation
|
737
744
|
|
738
|
-
|
739
|
-
|
740
|
-
|
745
|
+
em-http-request was modified to emit a warning if being used without the TLS
|
746
|
+
``verify_peer`` option. Puffing Billy defaults to specifying ``verify_peer: false``
|
747
|
+
but you can now modify configuration to do peer verification. So if you've
|
748
|
+
gone to the trouble of setting up your own certificate authority and self-signed
|
749
|
+
certs you can enable it like so:
|
741
750
|
|
742
|
-
|
751
|
+
```ruby
|
752
|
+
Billy.configure do |c|
|
753
|
+
c.verify_peer = true
|
754
|
+
end
|
755
|
+
```
|
743
756
|
|
744
|
-
|
757
|
+
## Resources
|
745
758
|
|
746
|
-
|
759
|
+
* [Bring Ruby VCR to Javascript testing with Capybara and puffing-billy](https://dzone.com/articles/bring-ruby-vcr-javascript)
|
760
|
+
* [Clean-up unused cache files periodically with this config](https://github.com/oesmith/puffing-billy/pull/26#issuecomment-29905030)
|
747
761
|
|
748
762
|
## Contributing
|
749
763
|
|
@@ -755,5 +769,5 @@ custom on-after hook.
|
|
755
769
|
|
756
770
|
## TODO
|
757
771
|
|
758
|
-
1. Integration for test frameworks other than
|
772
|
+
1. Integration for test frameworks other than RSpec.
|
759
773
|
2. Show errors from the EventMachine reactor loop in the test output.
|
data/lib/billy/browsers/watir.rb
CHANGED
@@ -20,8 +20,10 @@ module Billy
|
|
20
20
|
|
21
21
|
def configure_chrome(args)
|
22
22
|
args[:headless] = true
|
23
|
-
args[:
|
24
|
-
|
23
|
+
args[:proxy] = {
|
24
|
+
http: "#{Billy.proxy.host}:#{Billy.proxy.port}",
|
25
|
+
ssl: "#{Billy.proxy.host}:#{Billy.proxy.port}"
|
26
|
+
}
|
25
27
|
args
|
26
28
|
end
|
27
29
|
|
data/lib/billy/config.rb
CHANGED
@@ -8,7 +8,7 @@ module Billy
|
|
8
8
|
|
9
9
|
attr_accessor :logger, :cache, :cache_request_headers, :whitelist, :cache_whitelist, :path_blacklist, :ignore_params, :allow_params,
|
10
10
|
:persist_cache, :ignore_cache_port, :non_successful_cache_disabled, :non_successful_error_level,
|
11
|
-
:non_whitelisted_requests_disabled, :cache_path, :certs_path, :proxy_host, :proxy_port, :proxied_request_inactivity_timeout,
|
11
|
+
:non_whitelisted_requests_disabled, :cache_path, :certs_path, :verify_peer, :proxy_host, :proxy_port, :proxied_request_inactivity_timeout,
|
12
12
|
:proxied_request_connect_timeout, :dynamic_jsonp, :dynamic_jsonp_keys, :dynamic_jsonp_callback_name, :merge_cached_responses_whitelist,
|
13
13
|
:strip_query_params, :proxied_request_host, :proxied_request_port, :cache_request_body_methods, :after_cache_handles_request,
|
14
14
|
:cache_simulates_network_delays, :cache_simulates_network_delay_time, :record_requests, :record_stub_requests, :use_ignore_params, :before_handle_request
|
@@ -37,6 +37,7 @@ module Billy
|
|
37
37
|
@non_whitelisted_requests_disabled = false
|
38
38
|
@cache_path = File.join(Dir.tmpdir, 'puffing-billy')
|
39
39
|
@certs_path = File.join(Dir.tmpdir, 'puffing-billy', 'certs')
|
40
|
+
@verify_peer = false
|
40
41
|
@proxy_host = 'localhost'
|
41
42
|
@proxy_port = RANDOM_AVAILABLE_PORT
|
42
43
|
@proxied_request_inactivity_timeout = 10 # defaults from https://github.com/igrigorik/em-http-request/wiki/Redirects-and-Timeouts
|
@@ -16,6 +16,10 @@ module Billy
|
|
16
16
|
opts = { inactivity_timeout: Billy.config.proxied_request_inactivity_timeout,
|
17
17
|
connect_timeout: Billy.config.proxied_request_connect_timeout }
|
18
18
|
|
19
|
+
if url =~ /^https/
|
20
|
+
opts.merge!({tls: {verify_peer: Billy.config.verify_peer}})
|
21
|
+
end
|
22
|
+
|
19
23
|
if Billy.config.proxied_request_host && !bypass_internal_proxy?(url)
|
20
24
|
opts.merge!({ proxy: { host: Billy.config.proxied_request_host,
|
21
25
|
port: Billy.config.proxied_request_port }} )
|
data/lib/billy/proxy.rb
CHANGED
@@ -62,7 +62,7 @@ module Billy
|
|
62
62
|
s.close
|
63
63
|
Billy.log(:info, "puffing-billy: Waiting for event machine to shutdown on port #{port}")
|
64
64
|
s
|
65
|
-
rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL, Errno::ENETUNREACH
|
65
|
+
rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL, Errno::ENETUNREACH, Errno::ECONNRESET
|
66
66
|
false
|
67
67
|
end
|
68
68
|
|
@@ -27,7 +27,7 @@ module Billy
|
|
27
27
|
# and ensure the location is safely created. Pass
|
28
28
|
# back the resulting path.
|
29
29
|
def write_file(name, contents)
|
30
|
-
path = File.join(Billy.config.certs_path, name)
|
30
|
+
path = File.join(Billy.config.certs_path, "#{Process.pid}-#{name}")
|
31
31
|
FileUtils.mkdir_p(File.dirname(path))
|
32
32
|
File.write(path, contents)
|
33
33
|
path
|
data/lib/billy/version.rb
CHANGED
data/puffing-billy.gemspec
CHANGED
@@ -14,21 +14,23 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.name = 'puffing-billy'
|
15
15
|
gem.require_paths = ['lib']
|
16
16
|
gem.version = Billy::VERSION
|
17
|
+
gem.required_ruby_version = '>= 2.6.0'
|
17
18
|
|
18
19
|
gem.add_development_dependency 'rspec'
|
19
20
|
gem.add_development_dependency 'thin'
|
20
|
-
gem.add_development_dependency 'faraday'
|
21
|
+
gem.add_development_dependency 'faraday', '>= 0.9.0'
|
21
22
|
gem.add_development_dependency 'apparition'
|
22
23
|
gem.add_development_dependency 'capybara'
|
23
|
-
gem.add_development_dependency 'selenium-webdriver'
|
24
|
+
gem.add_development_dependency 'selenium-webdriver', '>= 4.0.0'
|
24
25
|
gem.add_development_dependency 'rack'
|
25
26
|
gem.add_development_dependency 'rake'
|
26
27
|
gem.add_development_dependency 'guard'
|
27
28
|
gem.add_development_dependency 'rb-inotify'
|
28
29
|
gem.add_development_dependency 'pry'
|
29
30
|
gem.add_development_dependency 'cucumber'
|
30
|
-
gem.add_development_dependency 'watir', '
|
31
|
-
gem.add_development_dependency 'webdrivers'
|
31
|
+
gem.add_development_dependency 'watir', '>= 7.0.0'
|
32
|
+
gem.add_development_dependency 'webdrivers', '>= 5.0.0'
|
33
|
+
gem.add_development_dependency 'webrick'
|
32
34
|
gem.add_runtime_dependency 'addressable', '~> 2.5'
|
33
35
|
gem.add_runtime_dependency 'eventmachine', '~> 1.2'
|
34
36
|
gem.add_runtime_dependency 'em-synchrony'
|
@@ -208,8 +208,10 @@ describe Billy::ProxyHandler do
|
|
208
208
|
allow(Billy.config).to receive(:proxied_request_connect_timeout).and_return(24)
|
209
209
|
|
210
210
|
expect(EventMachine::HttpRequest).to receive(:new).with(request[:url],
|
211
|
-
|
212
|
-
|
211
|
+
{
|
212
|
+
inactivity_timeout: 42,
|
213
|
+
connect_timeout: 24
|
214
|
+
}
|
213
215
|
)
|
214
216
|
|
215
217
|
subject.handle_request(request[:method],
|
@@ -223,9 +225,11 @@ describe Billy::ProxyHandler do
|
|
223
225
|
allow(Billy.config).to receive(:proxied_request_port).and_return('2080')
|
224
226
|
|
225
227
|
expect(EventMachine::HttpRequest).to receive(:new).with(request[:url],
|
226
|
-
|
227
|
-
|
228
|
-
|
228
|
+
{
|
229
|
+
inactivity_timeout: 10,
|
230
|
+
connect_timeout: 5,
|
231
|
+
proxy: { host: '10.10.10.10', port: '2080' }
|
232
|
+
}
|
229
233
|
)
|
230
234
|
|
231
235
|
subject.handle_request(request[:method],
|
data/spec/lib/proxy_spec.rb
CHANGED
@@ -255,7 +255,7 @@ shared_examples_for 'a cache' do
|
|
255
255
|
|
256
256
|
it 'should raise error when disabled' do
|
257
257
|
# TODO: Suppress stderr output: https://gist.github.com/adamstegman/926858
|
258
|
-
expect { http.get('/foo') }.to raise_error(Faraday::
|
258
|
+
expect { http.get('/foo') }.to raise_error(Faraday::ConnectionFailed, 'end of file reached')
|
259
259
|
end
|
260
260
|
end
|
261
261
|
|
@@ -284,7 +284,7 @@ shared_examples_for 'a cache' do
|
|
284
284
|
end
|
285
285
|
|
286
286
|
it 'should raise error for non-successful responses when :error' do
|
287
|
-
expect { http_error.get('/foo') }.to raise_error(Faraday::
|
287
|
+
expect { http_error.get('/foo') }.to raise_error(Faraday::ConnectionFailed)
|
288
288
|
end
|
289
289
|
end
|
290
290
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puffing-billy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olly Smith
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.9.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.9.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: apparition
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 4.0.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 4.0.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rack
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,18 +182,32 @@ dependencies:
|
|
182
182
|
name: watir
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- - "
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
187
|
+
version: 7.0.0
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- - "
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: 7.0.0
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: webdrivers
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 5.0.0
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 5.0.0
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: webrick
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|
198
212
|
requirements:
|
199
213
|
- - ">="
|
@@ -319,9 +333,9 @@ executables:
|
|
319
333
|
extensions: []
|
320
334
|
extra_rdoc_files: []
|
321
335
|
files:
|
336
|
+
- ".github/workflows/ci.yml"
|
322
337
|
- ".gitignore"
|
323
338
|
- ".rspec"
|
324
|
-
- ".travis.yml"
|
325
339
|
- CHANGELOG.md
|
326
340
|
- Dockerfile
|
327
341
|
- Gemfile
|
@@ -397,7 +411,7 @@ files:
|
|
397
411
|
homepage: https://github.com/oesmith/puffing-billy
|
398
412
|
licenses: []
|
399
413
|
metadata: {}
|
400
|
-
post_install_message:
|
414
|
+
post_install_message:
|
401
415
|
rdoc_options: []
|
402
416
|
require_paths:
|
403
417
|
- lib
|
@@ -405,16 +419,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
405
419
|
requirements:
|
406
420
|
- - ">="
|
407
421
|
- !ruby/object:Gem::Version
|
408
|
-
version:
|
422
|
+
version: 2.6.0
|
409
423
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
410
424
|
requirements:
|
411
425
|
- - ">="
|
412
426
|
- !ruby/object:Gem::Version
|
413
427
|
version: '0'
|
414
428
|
requirements: []
|
415
|
-
|
416
|
-
|
417
|
-
signing_key:
|
429
|
+
rubygems_version: 3.2.22
|
430
|
+
signing_key:
|
418
431
|
specification_version: 4
|
419
432
|
summary: Easy request stubs for browser tests.
|
420
433
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- 2.3
|
5
|
-
- 2.4
|
6
|
-
- 2.5
|
7
|
-
- 2.6
|
8
|
-
|
9
|
-
cache:
|
10
|
-
bundler: true
|
11
|
-
directories:
|
12
|
-
- $HOME/.webdrivers
|
13
|
-
|
14
|
-
addons:
|
15
|
-
chrome: stable
|
16
|
-
apt:
|
17
|
-
update: true
|
18
|
-
|
19
|
-
sudo: false
|
20
|
-
dist: xenial
|
21
|
-
|
22
|
-
rvm:
|
23
|
-
- 2.3
|
24
|
-
- 2.4
|
25
|
-
- 2.5
|
26
|
-
- 2.6
|
27
|
-
|
28
|
-
matrix:
|
29
|
-
fast_finish: true
|
30
|
-
|
31
|
-
bundler_args: --jobs 3 --retry 3
|
32
|
-
|
33
|
-
before_install:
|
34
|
-
- gem update --system
|
35
|
-
- gem install bundler
|
36
|
-
|