Fix for #161 When using Rails 2.3 it uses Rack::Utils to parse params

This commit is contained in:
Matthew Ford 2009-02-26 14:39:10 +00:00 committed by Luke Melia
parent 00433bafe5
commit 740bb293e3
2 changed files with 9 additions and 5 deletions

View File

@ -2,6 +2,7 @@
* Minor enhancements
* When using Rails 2.3, use Rack::Utils to parse params (Matthew Ford)
* Initial Merb and Sinatra compatibility for Selenium mode (Corey Donohoe)
* Add application_framework config for Selenium mode to determine how to
start and stop the app server (Corey Donohoe)

View File

@ -80,7 +80,7 @@ module Webrat
case Webrat.configuration.mode
when :rails
rails_request_parser.parse_query_parameters("#{name}=#{escaped_value}")
parse_rails_request_params("#{name}=#{escaped_value}")
when :merb
::Merb::Parse.query("#{name}=#{escaped_value}")
else
@ -98,12 +98,15 @@ module Webrat
protected
def rails_request_parser
def parse_rails_request_params(params)
if defined?(ActionController::AbstractRequest)
ActionController::AbstractRequest
else
ActionController::AbstractRequest.parse_query_parameters(params)
elsif defined?(ActionController::UrlEncodedPairParser)
# For Rails > 2.2
ActionController::UrlEncodedPairParser
ActionController::UrlEncodedPairParser.parse_query_parameters(params)
else
# For Rails > 2.3
Rack::Utils.parse_nested_query(params)
end
end