diff --git a/History.txt b/History.txt index de7cf54..00d632f 100644 --- a/History.txt +++ b/History.txt @@ -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) diff --git a/lib/webrat/core/elements/field.rb b/lib/webrat/core/elements/field.rb index ef3fd2b..fc3f9ec 100644 --- a/lib/webrat/core/elements/field.rb +++ b/lib/webrat/core/elements/field.rb @@ -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