module Capybara
def using_session(name_or_session)
Yield a block using a specific session name or Capybara::Session instance.
#
def using_session(name_or_session) previous_session_info = { specified_session: specified_session, session_name: session_name, current_driver: current_driver, app: app } self.specified_session = self.session_name = nil if name_or_session.is_a? Capybara::Session self.specified_session = name_or_session else self.session_name = name_or_session end yield ensure self.session_name, self.specified_session = previous_session_info.values_at(:session_name, :specified_session) self.current_driver, self.app = previous_session_info.values_at(:current_driver, :app) if threadsafe end