Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix broken cukes.

We can't have different adapters return different values for #normalize_uri because it breaks when you stub with multiple libraries.
  • Loading branch information...
commit 70b195f2995e6f3b2edc328b320c3125ad93b48d 1 parent 0d4d9f5
@myronmarston authored
View
5 lib/vcr/http_stubbing_adapters/common.rb
@@ -67,11 +67,6 @@ def restore_stubs_checkpoint(cassette)
raise ArgumentError.new("No checkpoint for #{cassette.inspect} could be found")
end
- def normalize_uri(uri)
- # the adapters can implement this if they want
- uri
- end
-
private
def compare_version
View
16 lib/vcr/http_stubbing_adapters/faraday.rb
@@ -26,7 +26,8 @@ def uri_should_be_ignored?(uri)
def stub_requests(http_interactions, match_attributes)
grouped_responses(http_interactions, match_attributes).each do |request_matcher, responses|
- queue = stub_queues[request_matcher]
+ matcher = request_matcher_with_normalized_uri(request_matcher)
+ queue = stub_queues[matcher]
responses.each { |res| queue << res }
end
end
@@ -51,10 +52,6 @@ def reset!
end
end
- def normalize_uri(uri)
- super.gsub('+', '%20')
- end
-
private
def version
@@ -86,6 +83,15 @@ def stub_queue_dup
def hash_of_arrays
Hash.new { |h, k| h[k] = [] }
end
+
+ def request_matcher_with_normalized_uri(matcher)
+ return matcher unless matcher.uri.is_a?(String) && matcher.uri.include?('+')
+
+ request = matcher.request.dup
+ request.uri = request.uri.gsub('+', '%20')
+
+ RequestMatcher.new(request, matcher.match_attributes)
+ end
end
end
end
View
2  lib/vcr/structs/normalizers/uri.rb
@@ -27,7 +27,7 @@ def normalize_uri
# urls have always included it). We force it to be included
# here by redefining default_port so that URI#to_s will include it.
def u.default_port; nil; end
- self.uri = VCR.http_stubbing_adapter.normalize_uri(u.to_s)
+ self.uri = u.to_s
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.