From e46df8c6f95a62dbde22c3e828810c8f9c22eebf Mon Sep 17 00:00:00 2001 From: Mike Gaffney Date: Wed, 3 Jun 2009 22:06:07 -0500 Subject: [PATCH] made tests cleaner and better coverage --- spec/public/selenium/selenium_session_spec.rb | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/spec/public/selenium/selenium_session_spec.rb b/spec/public/selenium/selenium_session_spec.rb index 91916f2..f244815 100644 --- a/spec/public/selenium/selenium_session_spec.rb +++ b/spec/public/selenium/selenium_session_spec.rb @@ -20,9 +20,29 @@ describe Webrat::SeleniumSession do @selenium.yieldable_exceptions.should == [::Spec::Expectations::ExpectationNotMetError, ::Selenium::CommandError, Webrat::WebratError] end - it "should handle yieldable exceptions in the wait_for" do + it "should throw timeout instead of spec expectionnotmet error" do begin - @selenium.wait_for(:timeout => 0.25) do + @selenium.wait_for(:timeout => 0.1) do + raise ::Spec::Expectations::ExpectationNotMetError + end + fail("didn't throw") + rescue Webrat::TimeoutError + end + end + + it "should throw timeout instead of selenium command error" do + begin + @selenium.wait_for(:timeout => 0.1) do + raise ::Selenium::CommandError + end + fail("didn't throw") + rescue Webrat::TimeoutError + end + end + + it "should throw timeout instead of webrat error" do + begin + @selenium.wait_for(:timeout => 0.1) do raise Webrat::WebratError.new end fail("didn't throw")