vcr 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/CHANGELOG.md +1 -0
- data/features/CONTRIBUTING.md +1 -0
- data/features/LICENSE.md +1 -0
- data/features/README.md +1 -0
- data/features/Upgrade.md +1 -0
- data/features/configuration/debug_logging.feature +0 -1
- data/features/configuration/hook_into.feature +2 -2
- data/features/hooks/around_http_request.feature +1 -1
- data/lib/vcr/library_hooks/webmock.rb +24 -7
- data/lib/vcr/util/internet_connection.rb +1 -1
- data/lib/vcr/version.rb +1 -1
- data/spec/lib/vcr/library_hooks/webmock_spec.rb +0 -1
- data/spec/lib/vcr/middleware/faraday_spec.rb +0 -1
- metadata +14 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bd06000e811a9f066f1d73a5d955bbb4ad3733e
|
4
|
+
data.tar.gz: 2784446a0155cfef8d7389208213b5b86aad1b8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb7de4b059e58371b9669c4bf72c3c5f806594e5f9cbd614ed5e41bbbd40d30f38a2bf5e2e079da0b139989aaca57080134d736f8680ff0344191f47a2ceba45
|
7
|
+
data.tar.gz: 1cf77c3a9198f1995721acbabd3470f2735d7e682280f218bdc46385342923beb6956080522e37761132f60ea1d4b67e4a5cfac5bd33d6471df22105a60cb766
|
@@ -0,0 +1 @@
|
|
1
|
+
/Users/tony/src/vcr/CHANGELOG.md
|
@@ -0,0 +1 @@
|
|
1
|
+
/Users/tony/src/vcr/CONTRIBUTING.md
|
data/features/LICENSE.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/Users/tony/src/vcr/LICENSE
|
data/features/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/Users/tony/src/vcr/README.md
|
data/features/Upgrade.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/Users/tony/src/vcr/Upgrade.md
|
@@ -21,7 +21,7 @@ Feature: hook_into
|
|
21
21
|
There are some addiitonal trade offs to consider when deciding which
|
22
22
|
option to use:
|
23
23
|
|
24
|
-
- WebMock uses extensive monkey patching to hook into supported HTTP
|
24
|
+
- WebMock uses extensive monkey patching to hook into supported HTTP
|
25
25
|
libraries. No monkey patching is used for Typhoeus, Excon or Faraday.
|
26
26
|
- Typhoeus, Excon, Faraday can be used together, and with either FakeWeb or WebMock.
|
27
27
|
- FakeWeb and WebMock cannot both be used at the same time.
|
@@ -85,7 +85,7 @@ Feature: hook_into
|
|
85
85
|
| c.hook_into :faraday | faraday (w/ net_http) |
|
86
86
|
| c.hook_into :faraday | faraday (w/ typhoeus) |
|
87
87
|
|
88
|
-
@exclude-jruby @exclude-rbx
|
88
|
+
@exclude-jruby @exclude-rbx
|
89
89
|
Scenario Outline: Use Typhoeus, Excon and Faraday in combination with FakeWeb or WebMock
|
90
90
|
Given a file named "hook_into_multiple.rb" with:
|
91
91
|
"""ruby
|
@@ -4,25 +4,42 @@ require 'webmock'
|
|
4
4
|
|
5
5
|
VCR::VersionChecker.new('WebMock', WebMock.version, '1.8.0').check_version!
|
6
6
|
|
7
|
+
WebMock.enable!
|
8
|
+
|
7
9
|
module VCR
|
8
10
|
class LibraryHooks
|
9
11
|
# @private
|
10
12
|
module WebMock
|
11
13
|
extend self
|
12
14
|
|
13
|
-
|
14
|
-
alias global_hook_disabled? global_hook_disabled
|
15
|
+
@global_hook_disabled_requests = {}
|
15
16
|
|
16
|
-
def with_global_hook_disabled
|
17
|
-
|
17
|
+
def with_global_hook_disabled(request)
|
18
|
+
global_hook_disabled_requests << request
|
18
19
|
|
19
20
|
begin
|
20
21
|
yield
|
21
22
|
ensure
|
22
|
-
|
23
|
+
global_hook_disabled_requests.delete(request)
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
27
|
+
def global_hook_disabled?(request)
|
28
|
+
requests = @global_hook_disabled_requests[Thread.current.object_id]
|
29
|
+
requests && requests.include?(request)
|
30
|
+
end
|
31
|
+
|
32
|
+
def global_hook_disabled_requests
|
33
|
+
requests = @global_hook_disabled_requests[Thread.current.object_id]
|
34
|
+
return requests if requests
|
35
|
+
|
36
|
+
ObjectSpace.define_finalizer(Thread.current, lambda {
|
37
|
+
@global_hook_disabled_requests.delete(Thread.current.object_id)
|
38
|
+
})
|
39
|
+
|
40
|
+
@global_hook_disabled_requests[Thread.current.object_id] = []
|
41
|
+
end
|
42
|
+
|
26
43
|
# @private
|
27
44
|
module Helpers
|
28
45
|
def vcr_request_for(webmock_request)
|
@@ -88,7 +105,7 @@ module VCR
|
|
88
105
|
|
89
106
|
def externally_stubbed?
|
90
107
|
# prevent infinite recursion...
|
91
|
-
VCR::LibraryHooks::WebMock.with_global_hook_disabled do
|
108
|
+
VCR::LibraryHooks::WebMock.with_global_hook_disabled(request) do
|
92
109
|
::WebMock.registered_request?(request)
|
93
110
|
end
|
94
111
|
end
|
@@ -124,7 +141,7 @@ module VCR
|
|
124
141
|
extend Helpers
|
125
142
|
|
126
143
|
::WebMock.globally_stub_request do |req|
|
127
|
-
global_hook_disabled? ? nil : RequestHandler.new(req).handle
|
144
|
+
global_hook_disabled?(req) ? nil : RequestHandler.new(req).handle
|
128
145
|
end
|
129
146
|
|
130
147
|
::WebMock.after_request(:real_requests_only => true) do |request, response|
|
data/lib/vcr/version.rb
CHANGED
@@ -71,7 +71,6 @@ describe "WebMock hook", :with_monkey_patches => :webmock do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
http_libs = %w[net/http patron httpclient em-http-request curb typhoeus excon]
|
74
|
-
http_libs.delete('patron') if RUBY_VERSION == '1.8.7'
|
75
74
|
http_libs.each do |lib|
|
76
75
|
other = []
|
77
76
|
other << :status_message_not_exposed if lib == 'excon'
|
@@ -3,7 +3,6 @@ require 'vcr/library_hooks/faraday'
|
|
3
3
|
|
4
4
|
describe VCR::Middleware::Faraday do
|
5
5
|
http_libs = %w[ typhoeus net_http patron ]
|
6
|
-
http_libs.delete('patron') if RUBY_VERSION == '1.8.7'
|
7
6
|
http_libs.each do |lib|
|
8
7
|
it_behaves_like 'a hook into an HTTP library', :faraday, "faraday (w/ #{lib})",
|
9
8
|
:status_message_not_exposed,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Myron Marston
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -326,6 +326,11 @@ executables: []
|
|
326
326
|
extensions: []
|
327
327
|
extra_rdoc_files: []
|
328
328
|
files:
|
329
|
+
- features/CHANGELOG.md
|
330
|
+
- features/CONTRIBUTING.md
|
331
|
+
- features/LICENSE.md
|
332
|
+
- features/README.md
|
333
|
+
- features/Upgrade.md
|
329
334
|
- features/about_these_examples.md
|
330
335
|
- features/cassettes/allow_unused_http_interactions.feature
|
331
336
|
- features/cassettes/automatic_re_recording.feature
|
@@ -487,7 +492,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
487
492
|
requirements:
|
488
493
|
- - ">="
|
489
494
|
- !ruby/object:Gem::Version
|
490
|
-
version:
|
495
|
+
version: 1.9.3
|
491
496
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
492
497
|
requirements:
|
493
498
|
- - ">="
|
@@ -495,7 +500,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
495
500
|
version: '0'
|
496
501
|
requirements: []
|
497
502
|
rubyforge_project:
|
498
|
-
rubygems_version: 2.
|
503
|
+
rubygems_version: 2.5.1
|
499
504
|
signing_key:
|
500
505
|
specification_version: 4
|
501
506
|
summary: Record your test suite's HTTP interactions and replay them during future
|
@@ -564,6 +569,7 @@ test_files:
|
|
564
569
|
- features/cassettes/naming.feature
|
565
570
|
- features/cassettes/no_cassette.feature
|
566
571
|
- features/cassettes/update_content_length_header.feature
|
572
|
+
- features/CHANGELOG.md
|
567
573
|
- features/configuration/allow_http_connections_when_no_cassette.feature
|
568
574
|
- features/configuration/cassette_library_dir.feature
|
569
575
|
- features/configuration/debug_logging.feature
|
@@ -574,6 +580,7 @@ test_files:
|
|
574
580
|
- features/configuration/preserve_exact_body_bytes.feature
|
575
581
|
- features/configuration/query_parser.feature
|
576
582
|
- features/configuration/uri_parser.feature
|
583
|
+
- features/CONTRIBUTING.md
|
577
584
|
- features/getting_started.md
|
578
585
|
- features/hooks/after_http_request.feature
|
579
586
|
- features/hooks/around_http_request.feature
|
@@ -582,8 +589,10 @@ test_files:
|
|
582
589
|
- features/hooks/before_record.feature
|
583
590
|
- features/http_libraries/em_http_request.feature
|
584
591
|
- features/http_libraries/net_http.feature
|
592
|
+
- features/LICENSE.md
|
585
593
|
- features/middleware/faraday.feature
|
586
594
|
- features/middleware/rack.feature
|
595
|
+
- features/README.md
|
587
596
|
- features/record_modes/all.feature
|
588
597
|
- features/record_modes/new_episodes.feature
|
589
598
|
- features/record_modes/none.feature
|
@@ -608,4 +617,5 @@ test_files:
|
|
608
617
|
- features/test_frameworks/rspec_macro.feature
|
609
618
|
- features/test_frameworks/rspec_metadata.feature
|
610
619
|
- features/test_frameworks/test_unit.feature
|
620
|
+
- features/Upgrade.md
|
611
621
|
has_rdoc:
|