From 6816c46d47f5ff47b9697e927ee6eddcf29d29ff Mon Sep 17 00:00:00 2001 From: Mike Gaffney Date: Thu, 4 Jun 2009 14:24:17 -0500 Subject: [PATCH] refactored tests to be more rspeccy --- spec/public/selenium/selenium_session_spec.rb | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/spec/public/selenium/selenium_session_spec.rb b/spec/public/selenium/selenium_session_spec.rb index 22b8a4d..d76c95c 100644 --- a/spec/public/selenium/selenium_session_spec.rb +++ b/spec/public/selenium/selenium_session_spec.rb @@ -21,33 +21,27 @@ describe Webrat::SeleniumSession do end it "should throw timeout instead of spec expectionnotmet error" do - begin + lambda { @selenium.wait_for(:timeout => 0.1) do raise ::Spec::Expectations::ExpectationNotMetError end - fail("didn't throw") - rescue Webrat::TimeoutError - end + }.should raise_error(Webrat::TimeoutError) end it "should throw timeout instead of selenium command error" do - begin + lambda { @selenium.wait_for(:timeout => 0.1) do raise ::Selenium::CommandError end - fail("didn't throw") - rescue Webrat::TimeoutError - end + }.should raise_error(Webrat::TimeoutError) end it "should throw timeout instead of webrat error" do - begin + lambda { @selenium.wait_for(:timeout => 0.1) do raise Webrat::WebratError.new end - fail("didn't throw") - rescue Webrat::TimeoutError - end + }.should raise_error(Webrat::TimeoutError) end end