Permalink
Browse files

Added missing parenthesis in a condition which checks if net connect …

…is allowed
  • Loading branch information...
1 parent ece870f commit 224d056e851b4dde715c1694bcd0e66eff87d3b8 @bblimke committed Apr 4, 2012
Showing with 17 additions and 9 deletions.
  1. +17 −9 lib/webmock/webmock.rb
View
@@ -57,12 +57,20 @@ def self.net_connect_allowed?(uri = nil)
if uri.is_a?(String)
uri = WebMock::Util::URI.normalize_uri(uri)
end
+
Config.instance.allow_net_connect ||
- (Config.instance.allow_localhost && WebMock::Util::URI.is_uri_localhost?(uri)) ||
- Config.instance.allow && (
- (Config.instance.allow.kind_of?(Regexp) && uri.to_s =~ Config.instance.allow) ||
- (Config.instance.allow.respond_to?(:include?) &&
- Config.instance.allow.include?(uri.host) || Config.instance.allow.include?("#{uri.host}:#{uri.port}")))
+ (
+ Config.instance.allow_localhost && WebMock::Util::URI.is_uri_localhost?(uri)) ||
+ Config.instance.allow && (
+ (Config.instance.allow.kind_of?(Regexp) && uri.to_s =~ Config.instance.allow) ||
+ (
+ Config.instance.allow.respond_to?(:include?) &&
+ (
+ Config.instance.allow.include?(uri.host) ||
+ Config.instance.allow.include?("#{uri.host}:#{uri.port}")
+ )
+ )
+ )
end
def self.reset!
@@ -105,10 +113,10 @@ def self.globally_stub_request(&block)
registered_request?
).each do |method|
self.class_eval(%Q(
- def #{method}(*args, &block)
- WebMock::Deprecation.warning("WebMock##{method} instance method is deprecated. Please use WebMock.#{method} class method instead")
- WebMock.#{method}(*args, &block)
- end
+ def #{method}(*args, &block)
+ WebMock::Deprecation.warning("WebMock##{method} instance method is deprecated. Please use WebMock.#{method} class method instead")
+ WebMock.#{method}(*args, &block)
+ end
))
end

0 comments on commit 224d056

Please sign in to comment.