not passing empty params

This commit is contained in:
Krzysztof Zylawy 2008-10-21 16:47:15 +01:00
parent ddd0dd70c3
commit ff36b51adb
2 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ module Webrat
protected protected
def do_request(url, data, headers, method) def do_request(url, data, headers, method)
@response = request(url, :params => data, :headers => headers, :method => method) @response = request(url, :params => (data && data.any?) ? data : nil, :headers => headers, :method => method)
self.get(@response.headers['Location'], nil, @response.headers) if @response.status == 302 self.get(@response.headers['Location'], nil, @response.headers) if @response.status == 302
end end

View File

@ -7,7 +7,7 @@ describe Webrat::Session do
session = Webrat::Session.new session = Webrat::Session.new
response = OpenStruct.new response = OpenStruct.new
response.status = 200 response.status = 200
session.should_receive(:request).with('url', {:params=>{}, :method=>"GET", :headers=>nil}).and_return(response) session.should_receive(:request).with('url', {:params=> nil, :method=>"GET", :headers=>nil}).and_return(response)
session.get('url', {}, nil) session.get('url', {}, nil)
end end
@ -17,7 +17,7 @@ describe Webrat::Session do
response = OpenStruct.new response = OpenStruct.new
response.status = 200 response.status = 200
session.should_receive(:request).with('url', {:params=>{}, :method=>request_method.upcase, :headers=>nil}).and_return(response) session.should_receive(:request).with('url', {:params=>nil, :method=>request_method.upcase, :headers=>nil}).and_return(response)
session.send(request_method, 'url', {}, nil) session.send(request_method, 'url', {}, nil)
end end
end end