Skip to content

Commit

Permalink
Merge pull request bblimke#132 from stephencelis/warnings
Browse files Browse the repository at this point in the history
Fix various warnings.
  • Loading branch information
bblimke committed Sep 8, 2011
2 parents b1e9953 + 87926d1 commit 76eefec
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/webmock/http_lib_adapters/httpclient_adapter.rb
Expand Up @@ -150,7 +150,7 @@ def build_request_signature(req)
uri.userinfo = userinfo
end

request_signature = WebMock::RequestSignature.new(
WebMock::RequestSignature.new(
req.header.request_method.downcase.to_sym,
uri.to_s,
:body => req.content,
Expand Down
4 changes: 3 additions & 1 deletion lib/webmock/http_lib_adapters/net_http_response.rb
Expand Up @@ -15,7 +15,9 @@
module Net
module WebMockHTTPResponse
def read_body(dest = nil, &block)
return super if @__read_body_previously_called
if defined? @__read_body_previously_called && @__read_body_previously_called
return super
end
return @body if dest.nil? && block.nil?
raise ArgumentError.new("both arg and block given for HTTP method") if dest && block
return nil if @body.nil?
Expand Down
7 changes: 5 additions & 2 deletions lib/webmock/request_pattern.rb
Expand Up @@ -5,8 +5,11 @@ class RequestPattern
attr_reader :method_pattern, :uri_pattern, :body_pattern, :headers_pattern

def initialize(method, uri, options = {})
@method_pattern = MethodPattern.new(method)
@uri_pattern = create_uri_pattern(uri)
@method_pattern = MethodPattern.new(method)
@uri_pattern = create_uri_pattern(uri)
@body_pattern = nil
@headers_pattern = nil
@with_block = nil
assign_options(options)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/webmock/util/headers.rb
Expand Up @@ -24,7 +24,7 @@ def self.sorted_headers_string(headers)
str << headers.map do |k,v|
v = case v
when Regexp then v.inspect
when Array then "["+v.map{|v| "'#{v.to_s}'"}.join(", ")+"]"
when Array then "["+v.map{|w| "'#{w.to_s}'"}.join(", ")+"]"
else "'#{v.to_s}'"
end
"'#{k}'=>#{v}"
Expand Down
2 changes: 1 addition & 1 deletion lib/webmock/util/json.rb
Expand Up @@ -5,7 +5,7 @@ module Util
class JSON
def self.parse(json)
YAML.load(unescape(convert_json_to_yaml(json)))
rescue ArgumentError => e
rescue ArgumentError
raise ParseError, "Invalid JSON string"
end

Expand Down

0 comments on commit 76eefec

Please sign in to comment.