puffing-billy 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +6 -6
- data/README.md +15 -1
- data/lib/billy/cache.rb +3 -4
- data/lib/billy/handlers/proxy_handler.rb +14 -1
- data/lib/billy/version.rb +1 -1
- data/lib/tasks/billy.rake +1 -1
- data/puffing-billy.gemspec +2 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11f63ec36c7471c6290b07e64f35879c9b4efd7e
|
4
|
+
data.tar.gz: d309c50f0918f9893ddb9da69beb034bf3b26133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24b195fd2c7711efa8f9846b7cf97b2e55ddfab4ae181483645bcecaf78bd5c112e5d886d4ed51ba2de2e6fdfd1876a21eb52360efe323fe953515ce89643612
|
7
|
+
data.tar.gz: c88c7270b7921f76bc72eba910f2e8a6062cf0db17c8506d5389127ac18bb9677878fc6a3a2225bc195bdd5ea60d58f1b0db159e44320a5f6520373561d62e4b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
v0.9.2, 2017-01-18
|
2
|
+
------------------
|
3
|
+
* Ensure that files are closed after being opened [#175](https://github.com/oesmith/puffing-billy/pull/175)
|
4
|
+
* Fix floating scopes [#177](https://github.com/oesmith/puffing-billy/pull/177)
|
5
|
+
|
1
6
|
v0.9.1, 2016-07-28
|
2
7
|
------------------
|
3
8
|
* Rescue LoadErrors during driver registration [#170](https://github.com/oesmith/puffing-billy/pull/170)
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
puffing-billy (0.9.
|
5
|
-
addressable
|
4
|
+
puffing-billy (0.9.2)
|
5
|
+
addressable (~> 2.4.0)
|
6
6
|
em-http-request (~> 1.1.0)
|
7
7
|
em-synchrony
|
8
8
|
eventmachine (~> 1.0.4)
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
ffi (~> 1.0, >= 1.0.11)
|
29
29
|
cliver (0.3.2)
|
30
30
|
coderay (1.1.0)
|
31
|
-
cookiejar (0.3.
|
31
|
+
cookiejar (0.3.3)
|
32
32
|
cucumber (2.0.2)
|
33
33
|
builder (>= 2.1.2)
|
34
34
|
cucumber-core (~> 1.2.0)
|
@@ -40,15 +40,15 @@ GEM
|
|
40
40
|
gherkin (~> 2.12.0)
|
41
41
|
daemons (1.2.3)
|
42
42
|
diff-lcs (1.2.5)
|
43
|
-
em-http-request (1.1.
|
43
|
+
em-http-request (1.1.5)
|
44
44
|
addressable (>= 2.3.4)
|
45
|
-
cookiejar (
|
45
|
+
cookiejar (!= 0.3.1)
|
46
46
|
em-socksify (>= 0.3)
|
47
47
|
eventmachine (>= 1.0.3)
|
48
48
|
http_parser.rb (>= 0.6.0)
|
49
49
|
em-socksify (0.3.1)
|
50
50
|
eventmachine (>= 1.0.0.beta.4)
|
51
|
-
em-synchrony (1.0.
|
51
|
+
em-synchrony (1.0.6)
|
52
52
|
eventmachine (>= 1.0.0.beta.1)
|
53
53
|
eventmachine (1.0.8)
|
54
54
|
eventmachine_httpserver (0.2.1)
|
data/README.md
CHANGED
@@ -408,6 +408,21 @@ RSpec.configure do |config|
|
|
408
408
|
end
|
409
409
|
```
|
410
410
|
|
411
|
+
## Separate Cache Directory for Each Test (in Cucumber)
|
412
|
+
|
413
|
+
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 use a Before tag like so:
|
414
|
+
|
415
|
+
```rb
|
416
|
+
Before('@javascript') do |scenario, block|
|
417
|
+
Billy.configure do |c|
|
418
|
+
feature_name = scenario.feature.name.underscore
|
419
|
+
scenario_name = scenario.name.underscore
|
420
|
+
c.cache_path = "features/support/fixtures/req_cache/#{feature_name}/#{scenario_name}/"
|
421
|
+
Dir.mkdir_p(Billy.config.cache_path) unless File.exist?(Billy.config.cache_path)
|
422
|
+
end
|
423
|
+
end
|
424
|
+
```
|
425
|
+
|
411
426
|
## Stub requests recording
|
412
427
|
|
413
428
|
If you want to record requests to stubbed URIs, set the following configuration option:
|
@@ -478,7 +493,6 @@ end
|
|
478
493
|
|
479
494
|
Note that this approach may cause unexpected behavior if your backend sends the Referer HTTP header (which is unlikely).
|
480
495
|
|
481
|
-
|
482
496
|
## Resources
|
483
497
|
|
484
498
|
* [Bring Ruby VCR to Javascript testing with Capybara and puffing-billy](http://architects.dzone.com/articles/bring-ruby-vcr-javascript)
|
data/lib/billy/cache.rb
CHANGED
@@ -30,15 +30,15 @@ module Billy
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def fetch_from_persistence(key)
|
33
|
-
@cache[key] = YAML.
|
33
|
+
@cache[key] = YAML.load_file(cache_file(key)) if persisted?(key)
|
34
34
|
rescue ArgumentError => e
|
35
35
|
Billy.log :error, "Could not parse YAML: #{e.message}"
|
36
36
|
nil
|
37
37
|
end
|
38
38
|
|
39
|
-
def store(method, url, request_headers, body, response_headers, status, content)
|
39
|
+
def store(key, _scope, method, url, request_headers, body, response_headers, status, content)
|
40
40
|
cached = {
|
41
|
-
scope:
|
41
|
+
scope: _scope,
|
42
42
|
url: format_url(url),
|
43
43
|
body: body,
|
44
44
|
status: status,
|
@@ -49,7 +49,6 @@ module Billy
|
|
49
49
|
|
50
50
|
cached.merge!(request_headers: request_headers) if Billy.config.cache_request_headers
|
51
51
|
|
52
|
-
key = key(method, url, body)
|
53
52
|
@cache[key] = cached
|
54
53
|
|
55
54
|
if Billy.config.persist_cache
|
@@ -21,6 +21,9 @@ module Billy
|
|
21
21
|
port: Billy.config.proxied_request_port }} )
|
22
22
|
end
|
23
23
|
|
24
|
+
cache_scope = Billy::Cache.instance.scope
|
25
|
+
cache_key = Billy::Cache.instance.key(method.downcase, url, body)
|
26
|
+
|
24
27
|
req = EventMachine::HttpRequest.new(url, opts)
|
25
28
|
req = req.send(method.downcase, build_request_options(url, headers, body))
|
26
29
|
|
@@ -40,7 +43,17 @@ module Billy
|
|
40
43
|
end
|
41
44
|
|
42
45
|
if cacheable?(url, response[:headers], response[:status])
|
43
|
-
Billy::Cache.instance.store(
|
46
|
+
Billy::Cache.instance.store(
|
47
|
+
cache_key,
|
48
|
+
cache_scope,
|
49
|
+
method.downcase,
|
50
|
+
url,
|
51
|
+
headers,
|
52
|
+
body,
|
53
|
+
response[:headers],
|
54
|
+
response[:status],
|
55
|
+
response[:content]
|
56
|
+
)
|
44
57
|
end
|
45
58
|
|
46
59
|
Billy.log(:info, "puffing-billy: PROXY #{method} succeeded for '#{url}'")
|
data/lib/billy/version.rb
CHANGED
data/lib/tasks/billy.rake
CHANGED
data/puffing-billy.gemspec
CHANGED
@@ -28,7 +28,8 @@ Gem::Specification.new do |gem|
|
|
28
28
|
gem.add_development_dependency 'pry'
|
29
29
|
gem.add_development_dependency 'cucumber'
|
30
30
|
gem.add_development_dependency 'watir-webdriver'
|
31
|
-
|
31
|
+
# addressable 2.5.0 drops support for ruby 1.9.3
|
32
|
+
gem.add_runtime_dependency 'addressable', '~> 2.4.0'
|
32
33
|
gem.add_runtime_dependency 'eventmachine', '~> 1.0.4'
|
33
34
|
gem.add_runtime_dependency 'em-synchrony'
|
34
35
|
gem.add_runtime_dependency 'em-http-request', '~> 1.1.0'
|
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: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olly Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -196,16 +196,16 @@ dependencies:
|
|
196
196
|
name: addressable
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- - "
|
199
|
+
- - "~>"
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: 2.4.0
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- - "
|
206
|
+
- - "~>"
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: 2.4.0
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: eventmachine
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -386,7 +386,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
386
386
|
version: '0'
|
387
387
|
requirements: []
|
388
388
|
rubyforge_project:
|
389
|
-
rubygems_version: 2.
|
389
|
+
rubygems_version: 2.4.8
|
390
390
|
signing_key:
|
391
391
|
specification_version: 4
|
392
392
|
summary: Easy request stubs for browser tests.
|
@@ -411,3 +411,4 @@ test_files:
|
|
411
411
|
- spec/lib/proxy_spec.rb
|
412
412
|
- spec/spec_helper.rb
|
413
413
|
- spec/support/test_server.rb
|
414
|
+
has_rdoc:
|