From b3fa158d1c4d8e03b8dc04f1e4f9940a8a4ef44c Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 27 Jun 2020 15:51:37 +0200 Subject: Update to ruby/spec@b6b7752 --- spec/ruby/library/timeout/timeout_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'spec/ruby/library/timeout/timeout_spec.rb') diff --git a/spec/ruby/library/timeout/timeout_spec.rb b/spec/ruby/library/timeout/timeout_spec.rb index a9a60fdeb9..584b38d8ec 100644 --- a/spec/ruby/library/timeout/timeout_spec.rb +++ b/spec/ruby/library/timeout/timeout_spec.rb @@ -18,6 +18,22 @@ describe "Timeout.timeout" do end.should raise_error(StandardError) end + it "raises specified error type with specified message when it times out" do + -> do + Timeout.timeout(1, StandardError, "foobar") do + sleep + end + end.should raise_error(StandardError, "foobar") + end + + it "raises specified error type with a default message when it times out if message is nil" do + -> do + Timeout.timeout(1, StandardError, nil) do + sleep + end + end.should raise_error(StandardError, "execution expired") + end + it "returns back the last value in the block" do Timeout.timeout(1) do 42 -- cgit v1.2.3