Compare commits

...

2 Commits

Author SHA1 Message Date
John Bintz 5e4ffeae9f ensure query strings are built correctly for mechanize 2010-06-01 14:29:57 -04:00
John Bintz 0856d8d405 potential fix for invalid query string construction 2010-06-01 14:10:39 -04:00
2 changed files with 19 additions and 1 deletions

View File

@ -110,7 +110,7 @@ module Webrat
when :rack, :sinatra when :rack, :sinatra
Rack::Utils.parse_nested_query(query_string) Rack::Utils.parse_nested_query(query_string)
else else
query_string.split('&').map {|query| { query.split('=').first => query.split('=').last }} Hash[query_string.split('&').map {|query| [ query.split('=').first, query.split('=').last ]}]
end end
end end

View File

@ -48,4 +48,22 @@ describe "Multiple nested params" do
webrat_session.should_receive(:post).with("/family", params) webrat_session.should_receive(:post).with("/family", params)
click_button click_button
end end
it "should correctly construct a query string" do
Webrat.configuration.mode = :mechanize
with_html <<-HTML
<html>
<form method="get" action="/search">
<input type="text" name="query" value="my-query" />
<input type="submit" />
</form>
</html>
HTML
params = { "query" => "my-query" }
webrat_session.should_receive(:get).with("/search", params)
click_button
end
end end