From 278074fdcd2f0f53904ef4c6304a504a57fd8ae8 Mon Sep 17 00:00:00 2001 From: Jonas Nicklas Date: Sun, 15 Nov 2009 23:20:37 +0100 Subject: [PATCH] Added reset_sessions! method --- lib/webcat/dsl.rb | 4 ++++ spec/dsl_spec.rb | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/webcat/dsl.rb b/lib/webcat/dsl.rb index f5b3e257..0ed5355a 100644 --- a/lib/webcat/dsl.rb +++ b/lib/webcat/dsl.rb @@ -20,6 +20,10 @@ module Webcat def current_session session_pool["#{current_driver}#{app.object_id}"] ||= Webcat::Session.new(current_driver, app) end + + def reset_sessions! + @session_pool = nil + end private diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb index 9d72a06e..5ffe0bd6 100644 --- a/spec/dsl_spec.rb +++ b/spec/dsl_spec.rb @@ -87,6 +87,15 @@ describe Webcat do Webcat.current_session.app.should == Webcat.app end end + + describe '.reset_sessions!' do + it "should clear any persisted sessions" do + object_id = Webcat.current_session.object_id + Webcat.current_session.object_id.should == object_id + Webcat.reset_sessions! + Webcat.current_session.object_id.should_not == object_id + end + end describe 'the DSL' do before do