lib/typhoeus/expectation.rb in typhoeus-0.5.2 vs lib/typhoeus/expectation.rb in typhoeus-0.5.3
- old
+ new
@@ -115,12 +115,11 @@
#
# @return [ Boolean ] True when matches, else false.
#
# @api private
def matches?(request)
- url_match?(request.url) &&
- (options ? options.all?{ |k,v| request.original_options[k] == v } : true)
+ url_match?(request.url) && options_match?(request)
end
# Return canned responses.
#
# @example Return responses.
@@ -149,9 +148,15 @@
response.mock = @from || true
response
end
private
+
+ # Check wether the options matches the request options.
+ # I checks options and original options.
+ def options_match?(request)
+ (options ? options.all?{ |k,v| request.original_options[k] == v || request.options[k] == v } : true)
+ end
# Check wether the url matches the request url.
# The url can be a string, regex or nil. String and
# regexp were checked, nil is always true. Else false.
#