vcr 3.0.1 → 3.0.2

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: 1c6e5ef325a46f12137b6d559a35e1664c684a7f
4
- data.tar.gz: c2bcdd8e42555694ec5cf081eccb74bb01ebd89f
3
+ metadata.gz: 3bd06000e811a9f066f1d73a5d955bbb4ad3733e
4
+ data.tar.gz: 2784446a0155cfef8d7389208213b5b86aad1b8e
5
5
  SHA512:
6
- metadata.gz: 687d5591fedaf5c58051814b07f7b5eb9e2a42d6179ddb946d9124ebbf07d58c2edf4bb90a16b80553e36ab93f91036fb25e51f2324bcb49ec1fd90795e7edba
7
- data.tar.gz: 85865a69856a58f4ad35f2fad7d8231071ad2e8c4bfc34b5d308a7bb90fdd31bec403e58a1df8bf7d77076eadec0351aa25593ab7b29aabdbfb602a56b3759df
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
@@ -0,0 +1 @@
1
+ /Users/tony/src/vcr/LICENSE
@@ -0,0 +1 @@
1
+ /Users/tony/src/vcr/README.md
@@ -0,0 +1 @@
1
+ /Users/tony/src/vcr/Upgrade.md
@@ -1,4 +1,3 @@
1
- @exclude-18
2
1
  Feature: Debug Logging
3
2
 
4
3
  Use the `debug_logger` option to set an IO-like object that VCR will log
@@ -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 @exclude-18
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
@@ -1,4 +1,4 @@
1
- @exclude-18 @exclude-1.9.3p327
1
+ @exclude-1.9.3p327
2
2
  Feature: around_http_request hook
3
3
 
4
4
  The `around_http_request` hook wraps each HTTP request. It can be used
@@ -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
- attr_accessor :global_hook_disabled
14
- alias global_hook_disabled? global_hook_disabled
15
+ @global_hook_disabled_requests = {}
15
16
 
16
- def with_global_hook_disabled
17
- self.global_hook_disabled = true
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
- self.global_hook_disabled = false
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|
@@ -13,7 +13,7 @@ module VCR
13
13
  module Ping
14
14
  def pingecho(host, timeout=5, service="echo")
15
15
  begin
16
- timeout(timeout) do
16
+ Timeout.timeout(timeout) do
17
17
  s = TCPSocket.new(host, service)
18
18
  s.close
19
19
  end
@@ -10,7 +10,7 @@ module VCR
10
10
  # * `parts` [Array<Integer>] List of the version parts.
11
11
  def version
12
12
  @version ||= begin
13
- string = '3.0.1'
13
+ string = '3.0.2'
14
14
 
15
15
  def string.parts
16
16
  split('.').map { |p| p.to_i }
@@ -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.1
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: 2015-12-21 00:00:00.000000000 Z
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: '0'
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.4.3
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: