Cleanup session initializaton in Webrat::Methods

This commit is contained in:
Bryan Helmkamp 2009-08-12 21:55:12 -04:00
parent ec43bb9546
commit 66251b66ae
2 changed files with 10 additions and 8 deletions

View File

@ -16,11 +16,11 @@ module Webrat
end
def webrat_session
@_webrat_session ||= ::Webrat::Session.new(webrat_adapter)
@_webrat_session ||= begin
session = Webrat.session_class.new
session.adapter = Webrat.adapter_class.new(self) if session.respond_to?(:adapter=)
session
end
def webrat_adapter
@_webrat_adapter ||= Webrat.adapter_class.new(self)
end
# all of these methods delegate to the @session, which should

View File

@ -59,6 +59,9 @@ For example:
extend Forwardable
include Logging
include SaveAndOpenPage
attr_accessor :adapter
attr_reader :current_url
attr_reader :elements
@ -67,12 +70,11 @@ For example:
:get, :post, :put, :delete
def initialize(adapter = nil)
@adapter = adapter
@http_method = :get
@data = {}
@default_headers = {}
@custom_headers = {}
@adapter = adapter
reset
end