Minor refactoring to extract rails_request_parser
This commit is contained in:
parent
7f38666325
commit
030412bd3f
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user