Refactoring request_page usage
This commit is contained in:
parent
c64556f489
commit
cc56a855cd
@ -53,7 +53,7 @@ module Webrat
|
||||
end
|
||||
|
||||
def submit
|
||||
Page.new(@page.session, form_action, form_method, params)
|
||||
@page.session.request_page(form_action, form_method, params)
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -13,9 +13,9 @@ module Webrat
|
||||
options[:javascript] = true if options[:javascript].nil?
|
||||
|
||||
if options[:javascript]
|
||||
Page.new(@page.session, absolute_href, method, data)
|
||||
@page.session.request_page(absolute_href, method, data)
|
||||
else
|
||||
Page.new(@page.session, absolute_href, :get, {})
|
||||
@page.session.request_page(absolute_href, :get, {})
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -68,10 +68,6 @@ module Webrat
|
||||
|
||||
def load_page
|
||||
session.request_page(@url, @method, @data)
|
||||
|
||||
save_and_open_page if session.exception_caught?
|
||||
|
||||
flunk("Page load was not successful (Code: #{session.response_code.inspect})") unless session.success_code?
|
||||
reset_scope
|
||||
end
|
||||
|
||||
|
@ -29,6 +29,9 @@ module Webrat
|
||||
def request_page(url, method, data)
|
||||
debug_log "REQUESTING PAGE: #{method.to_s.upcase} #{url} with #{data.inspect}"
|
||||
send "#{method}", url, data || {}
|
||||
|
||||
save_and_open_page if exception_caught?
|
||||
flunk("Page load was not successful (Code: #{session.response_code.inspect})") unless success_code?
|
||||
end
|
||||
|
||||
def success_code?
|
||||
|
Loading…
Reference in New Issue
Block a user