not passing empty params
This commit is contained in:
parent
ddd0dd70c3
commit
ff36b51adb
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user