Cleanup session initializaton in Webrat::Methods
This commit is contained in:
parent
ec43bb9546
commit
66251b66ae
|
@ -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
|
||||
|
|
|
@ -59,6 +59,9 @@ For example:
|
|||
extend Forwardable
|
||||
include Logging
|
||||
include SaveAndOpenPage
|
||||
|
||||
attr_accessor :adapter
|
||||
|
||||
attr_reader :current_url
|
||||
attr_reader :elements
|
||||
|
||||
|
@ -66,13 +69,12 @@ For example:
|
|||
:response_body=, :response_code=,
|
||||
:get, :post, :put, :delete
|
||||
|
||||
def initialize(adapter=nil)
|
||||
def initialize(adapter = nil)
|
||||
@adapter = adapter
|
||||
@http_method = :get
|
||||
@data = {}
|
||||
@default_headers = {}
|
||||
@custom_headers = {}
|
||||
@adapter = adapter
|
||||
|
||||
reset
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue