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
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