diff options
author | Benoit Daloze <[email protected]> | 2020-06-27 15:51:37 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2020-06-27 15:51:37 +0200 |
commit | b3fa158d1c4d8e03b8dc04f1e4f9940a8a4ef44c (patch) | |
tree | fa8a62d6192c24a21e70aa02589507adfe4e4e6a /spec/ruby/library/timeout/timeout_spec.rb | |
parent | 64d8c0815e6ab042e8a67a670bda9f34404fa662 (diff) |
Update to ruby/spec@b6b7752
Diffstat (limited to 'spec/ruby/library/timeout/timeout_spec.rb')
-rw-r--r-- | spec/ruby/library/timeout/timeout_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
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 |