made tests cleaner and better coverage

This commit is contained in:
Mike Gaffney 2009-06-03 22:06:07 -05:00
parent 977f643dca
commit e46df8c6f9
1 changed files with 22 additions and 2 deletions

View File

@ -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")