diff --git a/lib/webrat/core/elements/field.rb b/lib/webrat/core/elements/field.rb index 257c142..9c5073e 100644 --- a/lib/webrat/core/elements/field.rb +++ b/lib/webrat/core/elements/field.rb @@ -79,11 +79,7 @@ module Webrat case Webrat.configuration.mode when :rails - if defined?(ActionController::RequestParser) - ActionController::RequestParser.parse_query_parameters("#{name}=#{escaped_value}") - else - ActionController::AbstractRequest.parse_query_parameters("#{name}=#{escaped_value}") - end + rails_request_parser.parse_query_parameters("#{name}=#{escaped_value}") when :merb ::Merb::Parse.query("#{name}=#{escaped_value}") else @@ -101,6 +97,14 @@ module Webrat protected + def rails_request_parser + if defined?(ActionController::RequestParser) # For Rails > 2.2 + ActionController::RequestParser + else + ActionController::AbstractRequest + end + end + def form Form.load(@session, form_element) end