Extract Session#reset method

This commit is contained in:
Bryan Helmkamp 2008-11-29 01:05:19 -05:00
parent 154c83eced
commit 8e864f7e0d
1 changed files with 12 additions and 5 deletions

View File

@ -39,8 +39,9 @@ module Webrat
@data = {} @data = {}
@default_headers = {} @default_headers = {}
@custom_headers = {} @custom_headers = {}
@elements = {}
@context = context @context = context
reset
end end
# Saves the page out to RAILS_ROOT/tmp/ and opens it in the default # Saves the page out to RAILS_ROOT/tmp/ and opens it in the default
@ -112,9 +113,8 @@ module Webrat
save_and_open_page if exception_caught? && Webrat.configuration.open_error_files? save_and_open_page if exception_caught? && Webrat.configuration.open_error_files?
raise PageLoadError.new("Page load was not successful (Code: #{response_code.inspect}):\n#{formatted_error}") unless success_code? raise PageLoadError.new("Page load was not successful (Code: #{response_code.inspect}):\n#{formatted_error}") unless success_code?
@elements = {} reset
@_scopes = nil
@_page_scope = nil
@current_url = url @current_url = url
@http_method = http_method @http_method = http_method
@data = data @data = data
@ -220,7 +220,14 @@ module Webrat
def_delegators :current_scope, :field_by_xpath def_delegators :current_scope, :field_by_xpath
def_delegators :current_scope, :field_with_id def_delegators :current_scope, :field_with_id
private private
def reset
@elements = {}
@_scopes = nil
@_page_scope = nil
end
# accessor for testing # accessor for testing
def ruby_platform def ruby_platform
RUBY_PLATFORM RUBY_PLATFORM