Minor refactoring to extract rails_request_parser

This commit is contained in:
Bryan Helmkamp 2009-01-17 13:34:06 -05:00
parent 7f38666325
commit 030412bd3f
1 changed files with 9 additions and 5 deletions

View File

@ -79,11 +79,7 @@ module Webrat
case Webrat.configuration.mode case Webrat.configuration.mode
when :rails when :rails
if defined?(ActionController::RequestParser) rails_request_parser.parse_query_parameters("#{name}=#{escaped_value}")
ActionController::RequestParser.parse_query_parameters("#{name}=#{escaped_value}")
else
ActionController::AbstractRequest.parse_query_parameters("#{name}=#{escaped_value}")
end
when :merb when :merb
::Merb::Parse.query("#{name}=#{escaped_value}") ::Merb::Parse.query("#{name}=#{escaped_value}")
else else
@ -101,6 +97,14 @@ module Webrat
protected protected
def rails_request_parser
if defined?(ActionController::RequestParser) # For Rails > 2.2
ActionController::RequestParser
else
ActionController::AbstractRequest
end
end
def form def form
Form.load(@session, form_element) Form.load(@session, form_element)
end end