Refactoring request_page usage

This commit is contained in:
Bryan Helmkamp 2008-07-27 12:46:36 -04:00
parent c64556f489
commit cc56a855cd
4 changed files with 6 additions and 7 deletions

View File

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

View File

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

View File

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

View File

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