diff --git a/test/test_helper.rb b/test/test_helper.rb index a00682f8f..b7e382e8f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -75,34 +75,34 @@ end module WebMock - # class RequestPattern - # alias_method :_matches?, :matches? + class RequestPattern + alias_method :_matches?, :matches? - # def matches?(request_signature) - # return if request_signature.uri.host == '127.0.0.1' && request_signature.uri.path == '/__identify__' - # _matches?(request_signature) - # end - # end - - def self.net_connect_explicit_allowed?(allowed, uri=nil) - case allowed - when Array - allowed.any? { |allowed_item| net_connect_explicit_allowed?(allowed_item, uri) } - when Regexp - (uri.to_s =~ allowed) != nil || - (uri.omit(:port).to_s =~ allowed) != nil && uri.port == uri.default_port - when String - allowed == uri.to_s || - allowed == uri.host || - allowed == "#{uri.host}:#{uri.port}" || - allowed == "#{uri.scheme}://#{uri.host}:#{uri.port}" || - (allowed == uri.omit(:port).to_s && uri.port == uri.default_port) - else - if allowed.respond_to?(:call) - allowed.call(uri) - end + def matches?(request_signature) + return if request_signature.uri.host == '127.0.0.1' && request_signature.uri.path == '/__identify__' + _matches?(request_signature) end end + + # def self.net_connect_explicit_allowed?(allowed, uri=nil) + # case allowed + # when Array + # allowed.any? { |allowed_item| net_connect_explicit_allowed?(allowed_item, uri) } + # when Regexp + # (uri.to_s =~ allowed) != nil || + # (uri.omit(:port).to_s =~ allowed) != nil && uri.port == uri.default_port + # when String + # allowed == uri.to_s || + # allowed == uri.host || + # allowed == "#{uri.host}:#{uri.port}" || + # allowed == "#{uri.scheme}://#{uri.host}:#{uri.port}" || + # (allowed == uri.omit(:port).to_s && uri.port == uri.default_port) + # else + # if allowed.respond_to?(:call) + # allowed.call(uri) + # end + # end + # end end module ActiveSupport