Skip to content

Commit

Permalink
Spec that rescue *list converts using #to_a
Browse files Browse the repository at this point in the history
* See #2572
  • Loading branch information
eregon committed Jan 18, 2022
1 parent d97d1f3 commit 1deb3f4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/ruby/language/rescue_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,18 @@ class ArbitraryException < StandardError
end
end

it "converts the splatted list of exceptions using #to_a" do
exceptions = mock("to_a")
exceptions.should_receive(:to_a).and_return(exception_list)
caught_it = false
begin
raise SpecificExampleException, "not important"
rescue *exceptions
caught_it = true
end
caught_it.should be_true
end

it "can combine a splatted list of exceptions with a literal list of exceptions" do
caught_it = false
begin
Expand Down

0 comments on commit 1deb3f4

Please sign in to comment.