vcr 1.11.3 → 2.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. data/.gitignore +2 -0
  2. data/.travis.yml +6 -2
  3. data/CHANGELOG.md +49 -1
  4. data/Gemfile +1 -5
  5. data/Guardfile +0 -5
  6. data/README.md +3 -2
  7. data/Rakefile +11 -16
  8. data/cucumber.yml +0 -4
  9. data/features/.nav +14 -2
  10. data/features/cassettes/automatic_re_recording.feature +4 -6
  11. data/features/cassettes/dynamic_erb.feature +6 -8
  12. data/features/cassettes/exclusive.feature +111 -0
  13. data/features/cassettes/format.feature +16 -14
  14. data/features/cassettes/naming.feature +4 -6
  15. data/features/cassettes/no_cassette.feature +25 -28
  16. data/features/cassettes/update_content_length_header.feature +9 -9
  17. data/features/configuration/allow_http_connections_when_no_cassette.feature +6 -8
  18. data/features/configuration/cassette_library_dir.feature +4 -6
  19. data/features/configuration/default_cassette_options.feature +12 -10
  20. data/features/configuration/filter_sensitive_data.feature +12 -17
  21. data/features/configuration/{stub_with.feature → hook_into.feature} +63 -62
  22. data/features/configuration/hooks.feature +23 -33
  23. data/features/configuration/ignore_hosts.feature +16 -17
  24. data/features/configuration/ignore_localhost.feature +33 -42
  25. data/features/http_libraries/em_http_request.feature +7 -8
  26. data/features/http_libraries/net_http.feature +26 -28
  27. data/features/middleware/faraday.feature +17 -56
  28. data/features/middleware/rack.feature +8 -11
  29. data/features/record_modes/all.feature +5 -7
  30. data/features/record_modes/new_episodes.feature +5 -7
  31. data/features/record_modes/none.feature +6 -6
  32. data/features/record_modes/once.feature +6 -8
  33. data/features/request_matching/README.md +28 -0
  34. data/features/request_matching/body.feature +81 -0
  35. data/features/request_matching/custom_matcher.feature +125 -0
  36. data/features/request_matching/headers.feature +85 -0
  37. data/features/request_matching/host.feature +85 -0
  38. data/features/request_matching/identical_request_sequence.feature +79 -0
  39. data/features/request_matching/method.feature +86 -0
  40. data/features/request_matching/path.feature +86 -0
  41. data/features/request_matching/playback_repeats.feature +87 -0
  42. data/features/request_matching/uri.feature +84 -0
  43. data/features/request_matching/uri_without_param.feature +85 -0
  44. data/features/step_definitions/cli_steps.rb +4 -28
  45. data/features/support/env.rb +11 -9
  46. data/features/support/http_lib_filters.rb +2 -11
  47. data/features/support/vcr_cucumber_helpers.rb +4 -5
  48. data/features/test_frameworks/cucumber.feature +17 -18
  49. data/features/test_frameworks/rspec.feature +8 -12
  50. data/features/test_frameworks/shoulda.feature +5 -8
  51. data/features/test_frameworks/test_unit.feature +5 -8
  52. data/lib/vcr.rb +38 -58
  53. data/lib/vcr/cassette.rb +41 -60
  54. data/lib/vcr/cassette/http_interaction_list.rb +56 -0
  55. data/lib/vcr/cassette/reader.rb +29 -31
  56. data/lib/vcr/configuration.rb +76 -0
  57. data/lib/vcr/deprecations.rb +39 -0
  58. data/lib/vcr/errors.rb +22 -0
  59. data/lib/vcr/library_hooks.rb +19 -0
  60. data/lib/vcr/library_hooks/excon.rb +136 -0
  61. data/lib/vcr/library_hooks/fakeweb.rb +110 -0
  62. data/lib/vcr/library_hooks/faraday.rb +3 -0
  63. data/lib/vcr/library_hooks/typhoeus.rb +98 -0
  64. data/lib/vcr/library_hooks/webmock.rb +100 -0
  65. data/lib/vcr/middleware/faraday.rb +43 -36
  66. data/lib/vcr/middleware/rack.rb +28 -4
  67. data/lib/vcr/request_handler.rb +43 -0
  68. data/lib/vcr/request_ignorer.rb +31 -0
  69. data/lib/vcr/request_matcher_registry.rb +86 -0
  70. data/lib/vcr/structs/http_interaction.rb +24 -18
  71. data/lib/vcr/structs/normalizers/body.rb +1 -1
  72. data/lib/vcr/structs/normalizers/header.rb +1 -1
  73. data/lib/vcr/structs/normalizers/status_message.rb +1 -1
  74. data/lib/vcr/structs/normalizers/uri.rb +1 -1
  75. data/lib/vcr/structs/request.rb +0 -13
  76. data/lib/vcr/structs/response.rb +2 -9
  77. data/lib/vcr/structs/response_status.rb +0 -4
  78. data/lib/vcr/test_frameworks/cucumber.rb +1 -1
  79. data/lib/vcr/test_frameworks/rspec.rb +1 -1
  80. data/lib/vcr/util/hooks.rb +28 -19
  81. data/lib/vcr/util/internet_connection.rb +29 -2
  82. data/lib/vcr/util/version_checker.rb +60 -0
  83. data/lib/vcr/version.rb +1 -1
  84. data/script/FullBuildRakeFile +0 -7
  85. data/script/full_build +1 -1
  86. data/spec/capture_warnings.rb +36 -31
  87. data/spec/fixtures/{1.9.1/cassette_spec → cassette_spec}/empty.yml +0 -0
  88. data/spec/fixtures/{not_1.9.1/cassette_spec → cassette_spec}/example.yml +0 -0
  89. data/spec/fixtures/{not_1.9.1/cassette_spec → cassette_spec}/with_localhost_requests.yml +0 -0
  90. data/spec/fixtures/{not_1.9.1/fake_example.com_responses.yml → fake_example.com_responses.yml} +0 -0
  91. data/spec/fixtures/{not_1.9.1/match_requests_on.yml → match_requests_on.yml} +0 -0
  92. data/spec/monkey_patches.rb +40 -11
  93. data/spec/spec_helper.rb +7 -43
  94. data/spec/support/http_library_adapters.rb +3 -13
  95. data/spec/support/shared_example_groups/{http_library.rb → hook_into_http_library.rb} +39 -111
  96. data/spec/support/shared_example_groups/version_checking.rb +9 -9
  97. data/spec/vcr/cassette/http_interaction_list_spec.rb +178 -0
  98. data/spec/vcr/cassette/reader_spec.rb +2 -2
  99. data/spec/vcr/cassette_spec.rb +121 -156
  100. data/spec/vcr/configuration_spec.rb +143 -0
  101. data/spec/vcr/deprecations_spec.rb +91 -0
  102. data/spec/vcr/{http_stubbing_adapters → library_hooks}/excon_spec.rb +6 -9
  103. data/spec/vcr/library_hooks/fakeweb_spec.rb +83 -0
  104. data/spec/vcr/{http_stubbing_adapters → library_hooks}/typhoeus_spec.rb +7 -11
  105. data/spec/vcr/library_hooks/webmock_spec.rb +17 -0
  106. data/spec/vcr/library_hooks_spec.rb +51 -0
  107. data/spec/vcr/middleware/faraday_spec.rb +17 -44
  108. data/spec/vcr/middleware/rack_spec.rb +94 -58
  109. data/spec/vcr/request_ignorer_spec.rb +54 -0
  110. data/spec/vcr/request_matcher_registry_spec.rb +223 -0
  111. data/spec/vcr/structs/request_spec.rb +0 -33
  112. data/spec/vcr/structs/response_spec.rb +0 -24
  113. data/spec/vcr/structs/response_status_spec.rb +0 -9
  114. data/spec/vcr/util/hooks_spec.rb +3 -5
  115. data/spec/vcr/version_spec.rb +1 -1
  116. data/spec/vcr_spec.rb +79 -91
  117. data/vcr.gemspec +1 -1
  118. metadata +83 -103
  119. data/features/cassettes/request_matching.feature +0 -383
  120. data/lib/vcr/config.rb +0 -84
  121. data/lib/vcr/deprecations/cassette.rb +0 -29
  122. data/lib/vcr/deprecations/config.rb +0 -18
  123. data/lib/vcr/deprecations/http_stubbing_adapters/common.rb +0 -9
  124. data/lib/vcr/deprecations/http_stubbing_adapters/fakeweb.rb +0 -11
  125. data/lib/vcr/extensions/net_http.rb +0 -32
  126. data/lib/vcr/http_stubbing_adapters/common.rb +0 -202
  127. data/lib/vcr/http_stubbing_adapters/excon.rb +0 -178
  128. data/lib/vcr/http_stubbing_adapters/fakeweb.rb +0 -107
  129. data/lib/vcr/http_stubbing_adapters/faraday.rb +0 -26
  130. data/lib/vcr/http_stubbing_adapters/multi_object_proxy.rb +0 -43
  131. data/lib/vcr/http_stubbing_adapters/typhoeus.rb +0 -115
  132. data/lib/vcr/http_stubbing_adapters/webmock.rb +0 -120
  133. data/lib/vcr/middleware/cassette_arguments.rb +0 -19
  134. data/lib/vcr/middleware/common.rb +0 -20
  135. data/lib/vcr/request_matcher.rb +0 -94
  136. data/lib/vcr/rspec.rb +0 -2
  137. data/lib/vcr/util/basic_object.rb +0 -43
  138. data/lib/vcr/util/ping.rb +0 -30
  139. data/lib/vcr/util/regexes.rb +0 -37
  140. data/spec/fixtures/1.9.1/0_3_1_cassette.yml +0 -29
  141. data/spec/fixtures/1.9.1/cassette_spec/example.yml +0 -110
  142. data/spec/fixtures/1.9.1/cassette_spec/with_localhost_requests.yml +0 -109
  143. data/spec/fixtures/1.9.1/example_net_http.yml +0 -14
  144. data/spec/fixtures/1.9.1/example_net_http_request.yml +0 -12
  145. data/spec/fixtures/1.9.1/example_net_http_response.yml +0 -25
  146. data/spec/fixtures/1.9.1/fake_example.com_responses.yml +0 -108
  147. data/spec/fixtures/1.9.1/match_requests_on.yml +0 -185
  148. data/spec/fixtures/not_1.9.1/0_3_1_cassette.yml +0 -29
  149. data/spec/fixtures/not_1.9.1/cassette_spec/empty.yml +0 -0
  150. data/spec/fixtures/not_1.9.1/example_net_http.yml +0 -14
  151. data/spec/fixtures/not_1.9.1/example_net_http_request.yml +0 -12
  152. data/spec/fixtures/not_1.9.1/example_net_http_response.yml +0 -25
  153. data/spec/support/shared_example_groups/http_stubbing_adapter.rb +0 -133
  154. data/spec/support/shared_example_groups/ignore_localhost_deprecation.rb +0 -28
  155. data/spec/vcr/config_spec.rb +0 -181
  156. data/spec/vcr/deprecations/cassette_spec.rb +0 -57
  157. data/spec/vcr/deprecations/config_spec.rb +0 -30
  158. data/spec/vcr/deprecations/http_stubbing_adapters/common_spec.rb +0 -7
  159. data/spec/vcr/deprecations/http_stubbing_adapters/fakeweb_spec.rb +0 -16
  160. data/spec/vcr/extensions/net_http_spec.rb +0 -80
  161. data/spec/vcr/http_stubbing_adapters/fakeweb_spec.rb +0 -19
  162. data/spec/vcr/http_stubbing_adapters/faraday_spec.rb +0 -76
  163. data/spec/vcr/http_stubbing_adapters/multi_object_proxy_spec.rb +0 -101
  164. data/spec/vcr/http_stubbing_adapters/webmock_spec.rb +0 -17
  165. data/spec/vcr/middleware/cassette_arguments_spec.rb +0 -32
  166. data/spec/vcr/request_matcher_spec.rb +0 -230
@@ -1,107 +0,0 @@
1
- require 'fakeweb'
2
- require 'vcr/deprecations/http_stubbing_adapters/fakeweb'
3
- require 'vcr/extensions/net_http'
4
-
5
- module VCR
6
- module HttpStubbingAdapters
7
- module FakeWeb
8
- include VCR::HttpStubbingAdapters::Common
9
- extend self
10
-
11
- UNSUPPORTED_REQUEST_MATCH_ATTRIBUTES = [:body, :headers]
12
-
13
- MINIMUM_VERSION = '1.3.0'
14
- MAXIMUM_VERSION = '1.3'
15
-
16
- def http_connections_allowed=(value)
17
- @http_connections_allowed = value
18
- update_fakeweb_allow_net_connect
19
- end
20
-
21
- def http_connections_allowed?
22
- !!::FakeWeb.allow_net_connect?("http://some.url/besides/localhost")
23
- end
24
-
25
- def ignored_hosts=(hosts)
26
- @ignored_hosts = hosts
27
- update_fakeweb_allow_net_connect
28
- end
29
-
30
- def stub_requests(http_interactions, match_attributes)
31
- validate_match_attributes(match_attributes)
32
-
33
- grouped_responses(http_interactions, match_attributes).each do |request_matcher, responses|
34
- ::FakeWeb.register_uri(
35
- request_matcher.method || :any,
36
- request_matcher.uri,
37
- responses.map{ |r| response_hash(r) }
38
- )
39
- end
40
- end
41
-
42
- def create_stubs_checkpoint(cassette)
43
- checkpoints[cassette] = ::FakeWeb::Registry.instance.uri_map.dup
44
- end
45
-
46
- def restore_stubs_checkpoint(cassette)
47
- ::FakeWeb::Registry.instance.uri_map = checkpoints.delete(cassette) || raise_no_checkpoint_error(cassette)
48
- end
49
-
50
- def request_stubbed?(request, match_attributes)
51
- validate_match_attributes(match_attributes)
52
- !!::FakeWeb.registered_uri?(request.method, request.uri)
53
- end
54
-
55
- def request_uri(net_http, request)
56
- ::FakeWeb::Utility.request_uri_as_string(net_http, request)
57
- end
58
-
59
- private
60
-
61
- def ignored_hosts
62
- @ignored_hosts ||= []
63
- end
64
-
65
- def version
66
- ::FakeWeb::VERSION
67
- end
68
-
69
- def update_fakeweb_allow_net_connect
70
- ::FakeWeb.allow_net_connect = if @http_connections_allowed
71
- true
72
- elsif ignored_hosts.any?
73
- VCR::Regexes.url_regex_for_hosts(ignored_hosts)
74
- else
75
- false
76
- end
77
- end
78
-
79
- def checkpoints
80
- @checkpoints ||= {}
81
- end
82
-
83
- def response_hash(response)
84
- (response.headers || {}).merge(
85
- :body => response.body,
86
- :status => [response.status.code.to_s, response.status.message]
87
- )
88
- end
89
-
90
- def validate_match_attributes(match_attributes)
91
- invalid_attributes = match_attributes & UNSUPPORTED_REQUEST_MATCH_ATTRIBUTES
92
- if invalid_attributes.size > 0
93
- raise UnsupportedRequestMatchAttributeError.new("FakeWeb does not support matching requests on #{invalid_attributes.join(' or ')}")
94
- end
95
- end
96
-
97
- def initialize_ivars
98
- @http_connections_allowed = nil
99
- end
100
-
101
- initialize_ivars # to avoid warnings
102
- end
103
- end
104
- end
105
-
106
- VCR::HttpStubbingAdapters::Common.add_vcr_info_to_exception_message(FakeWeb::NetConnectNotAllowedError)
107
-
@@ -1,26 +0,0 @@
1
- require 'faraday'
2
-
3
- module VCR
4
- module HttpStubbingAdapters
5
- module Faraday
6
- include Common
7
- extend self
8
-
9
- MINIMUM_VERSION = '0.6.0'
10
- MAXIMUM_VERSION = '0.6'
11
-
12
- private
13
-
14
- def version
15
- ::Faraday::VERSION
16
- end
17
-
18
- def normalize_uri(uri)
19
- # faraday normalizes +'s to %20's
20
- uri.gsub('+', '%20')
21
- end
22
- end
23
- end
24
- end
25
-
26
- VCR::HttpStubbingAdapters::Common.add_vcr_info_to_exception_message(VCR::Middleware::Faraday::HttpConnectionNotAllowedError)
@@ -1,43 +0,0 @@
1
- module VCR
2
- module HttpStubbingAdapters
3
- class MultiObjectProxy < VCR::BasicObject
4
-
5
- def self.for(*objects)
6
- return objects.first if objects.size == 1
7
- new(*objects)
8
- end
9
-
10
- attr_reader :proxied_objects
11
-
12
- def initialize(*objects)
13
- ::Kernel.raise ::ArgumentError.new("You must pass at least one object to proxy to") if objects.empty?
14
- ::Kernel.raise ::ArgumentError.new("Cannot proxy to nil") if objects.any? { |o| o.nil? }
15
-
16
- @proxied_objects = objects
17
- end
18
-
19
- def respond_to?(message)
20
- proxied_objects.any? { |o| o.respond_to?(message) }
21
- end
22
-
23
- private
24
-
25
- def method_missing(name, *args)
26
- responding_proxied_objects = proxied_objects.select { |o| o.respond_to?(name) }
27
- return super if responding_proxied_objects.empty?
28
-
29
- uniq_return_vals = responding_proxied_objects.map { |o| o.__send__(name, *args) }.uniq
30
-
31
- return nil unless method_return_val_important?(name)
32
- return uniq_return_vals.first if uniq_return_vals.size == 1
33
-
34
- ::Kernel.raise "The proxied objects returned different values for calls to #{name}: #{uniq_return_vals.inspect}"
35
- end
36
-
37
- def method_return_val_important?(method_name)
38
- method_name == :request_uri || method_name.to_s =~ /\?$/
39
- end
40
- end
41
- end
42
- end
43
-
@@ -1,115 +0,0 @@
1
- require 'typhoeus'
2
-
3
- module VCR
4
- module HttpStubbingAdapters
5
- module Typhoeus
6
- include VCR::HttpStubbingAdapters::Common
7
- extend self
8
-
9
- MINIMUM_VERSION = '0.2.1'
10
- MAXIMUM_VERSION = '0.2'
11
-
12
- def http_connections_allowed=(value)
13
- ::Typhoeus::Hydra.allow_net_connect = value
14
- end
15
-
16
- def http_connections_allowed?
17
- !!::Typhoeus::Hydra.allow_net_connect?
18
- end
19
-
20
- def ignored_hosts=(hosts)
21
- ::Typhoeus::Hydra.ignore_hosts = hosts
22
- end
23
-
24
- def stub_requests(http_interactions, match_attributes)
25
- grouped_responses(http_interactions, match_attributes).each do |request_matcher, responses|
26
- ::Typhoeus::Hydra.stub(
27
- request_matcher.method || :any,
28
- request_matcher.uri,
29
- request_hash(request_matcher)
30
- ).and_return(
31
- responses.map do |response|
32
- ::Typhoeus::Response.new(
33
- :code => response.status.code,
34
- :body => response.body,
35
- :headers_hash => normalized_response_headers(response)
36
- )
37
- end
38
- )
39
- end
40
- end
41
-
42
- def create_stubs_checkpoint(cassette)
43
- checkpoints[cassette] = ::Typhoeus::Hydra.stubs.dup
44
- end
45
-
46
- def restore_stubs_checkpoint(cassette)
47
- ::Typhoeus::Hydra.stubs = checkpoints.delete(cassette) || raise_no_checkpoint_error(cassette)
48
- end
49
-
50
- def after_adapters_loaded
51
- # ensure WebMock's Typhoeus adapter does not conflict with us here
52
- # (i.e. to double record requests or whatever).
53
- if defined?(::WebMock::HttpLibAdapters::TyphoeusAdapter)
54
- ::WebMock::HttpLibAdapters::TyphoeusAdapter.disable!
55
- end
56
- end
57
-
58
- private
59
-
60
- def version
61
- ::Typhoeus::VERSION
62
- end
63
-
64
- def checkpoints
65
- @checkpoints ||= {}
66
- end
67
-
68
- def request_hash(request_matcher)
69
- hash = {}
70
-
71
- hash[:body] = request_matcher.body if request_matcher.match_requests_on?(:body)
72
- hash[:headers] = request_matcher.headers if request_matcher.match_requests_on?(:headers)
73
-
74
- hash
75
- end
76
-
77
- def normalized_response_headers(response)
78
- hash = {}
79
-
80
- response.headers.each do |key, values|
81
- hash[key] = values.size == 1 ? values.first : values
82
- end if response.headers
83
-
84
- hash
85
- end
86
- end
87
- end
88
- end
89
-
90
- Typhoeus::Hydra.after_request_before_on_complete do |request|
91
- if VCR::HttpStubbingAdapters::Typhoeus.enabled? && !request.response.mock?
92
- http_interaction = VCR::HTTPInteraction.new(
93
- VCR::Request.new(
94
- request.method,
95
- request.url,
96
- request.body,
97
- request.headers
98
- ),
99
- VCR::Response.new(
100
- VCR::ResponseStatus.new(
101
- request.response.code,
102
- request.response.status_message
103
- ),
104
- request.response.headers_hash,
105
- request.response.body,
106
- request.response.http_version
107
- )
108
- )
109
-
110
- VCR.record_http_interaction(http_interaction)
111
- end
112
- end
113
-
114
- VCR::HttpStubbingAdapters::Common.add_vcr_info_to_exception_message(Typhoeus::Hydra::NetConnectNotAllowedError)
115
-
@@ -1,120 +0,0 @@
1
- require 'webmock'
2
-
3
- module VCR
4
- module HttpStubbingAdapters
5
- module WebMock
6
- include VCR::HttpStubbingAdapters::Common
7
- extend self
8
-
9
- MINIMUM_VERSION = '1.7.0'
10
- MAXIMUM_VERSION = '1.7'
11
-
12
- def http_connections_allowed=(value)
13
- @http_connections_allowed = value
14
- update_webmock_allow_net_connect
15
- end
16
-
17
- def http_connections_allowed?
18
- !!::WebMock::Config.instance.allow_net_connect
19
- end
20
-
21
- def ignored_hosts=(hosts)
22
- @ignored_hosts = hosts
23
- update_webmock_allow_net_connect
24
- end
25
-
26
- def stub_requests(http_interactions, match_attributes)
27
- grouped_responses(http_interactions, match_attributes).each do |request_matcher, responses|
28
- stub = ::WebMock.stub_request(request_matcher.method || :any, request_matcher.uri)
29
-
30
- with_hash = request_signature_hash(request_matcher)
31
- stub = stub.with(with_hash) if with_hash.size > 0
32
-
33
- stub.to_return(responses.map{ |r| response_hash(r) })
34
- end
35
- end
36
-
37
- def create_stubs_checkpoint(cassette)
38
- checkpoints[cassette] = ::WebMock::StubRegistry.instance.request_stubs.dup
39
- end
40
-
41
- def restore_stubs_checkpoint(cassette)
42
- ::WebMock::StubRegistry.instance.request_stubs = checkpoints.delete(cassette) || raise_no_checkpoint_error(cassette)
43
- end
44
-
45
- private
46
-
47
- def version
48
- ::WebMock.version
49
- end
50
-
51
- def ignored_hosts
52
- @ignored_hosts ||= []
53
- end
54
-
55
- def update_webmock_allow_net_connect
56
- if @http_connections_allowed
57
- ::WebMock.allow_net_connect!
58
- else
59
- ::WebMock.disable_net_connect!(:allow => ignored_hosts)
60
- end
61
- end
62
-
63
- def request_signature_hash(request_matcher)
64
- signature = {}
65
- signature[:body] = request_matcher.body if request_matcher.match_requests_on?(:body)
66
- signature[:headers] = request_matcher.headers if request_matcher.match_requests_on?(:headers)
67
- signature
68
- end
69
-
70
- def response_hash(response)
71
- {
72
- :body => response.body,
73
- :status => [response.status.code.to_i, response.status.message],
74
- :headers => response.headers
75
- }
76
- end
77
-
78
- def checkpoints
79
- @checkpoints ||= {}
80
- end
81
-
82
- def initialize_ivars
83
- @http_connections_allowed = nil
84
- end
85
-
86
- initialize_ivars # to avoid warnings
87
- end
88
- end
89
- end
90
-
91
- WebMock.after_request(:real_requests_only => true) do |request, response|
92
- if VCR::HttpStubbingAdapters::WebMock.enabled?
93
- http_interaction = VCR::HTTPInteraction.new(
94
- VCR::Request.new(
95
- request.method,
96
- request.uri.to_s,
97
- request.body,
98
- request.headers
99
- ),
100
- VCR::Response.new(
101
- VCR::ResponseStatus.new(
102
- response.status.first,
103
- response.status.last
104
- ),
105
- response.headers,
106
- response.body,
107
- '1.1'
108
- )
109
- )
110
-
111
- VCR.record_http_interaction(http_interaction)
112
- end
113
- end
114
-
115
- WebMock::NetConnectNotAllowedError.class_eval do
116
- undef stubbing_instructions
117
- def stubbing_instructions(*args)
118
- '. ' + VCR::HttpStubbingAdapters::Common::RECORDING_INSTRUCTIONS
119
- end
120
- end
@@ -1,19 +0,0 @@
1
- module VCR
2
- module Middleware
3
- class CassetteArguments
4
- def initialize
5
- @name = nil
6
- @options = {}
7
- end
8
-
9
- def name(name = nil)
10
- @name = name if name
11
- @name
12
- end
13
-
14
- def options(options = {})
15
- @options.merge!(options)
16
- end
17
- end
18
- end
19
- end
@@ -1,20 +0,0 @@
1
- module VCR
2
- module Middleware
3
- module Common
4
- include VCR::VariableArgsBlockCaller
5
-
6
- def initialize(app, &block)
7
- raise ArgumentError.new("You must provide a block to set the cassette options") unless block
8
- @app, @cassette_arguments_block = app, block
9
- end
10
-
11
- private
12
-
13
- def cassette_arguments(env)
14
- arguments = CassetteArguments.new
15
- call_block(@cassette_arguments_block, arguments, env)
16
- [arguments.name, arguments.options]
17
- end
18
- end
19
- end
20
- end