Skip to content

Commit a261478

Browse files
committed
Fix Kernel#raise when it's called with a String message and an extra argument and raise TypeError
1 parent a8ed051 commit a261478

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

shared/kernel/raise.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ def initialize
8888
-> { @object.raise(nil) }.should raise_error(TypeError, "exception class/object expected")
8989
end
9090

91+
it "raises a TypeError when passed a message and an extra argument" do
92+
-> { @object.raise("message", {cause: RuntimeError.new()}) }.should raise_error(TypeError, "exception class/object expected")
93+
end
94+
9195
it "raises TypeError when passed a non-Exception object but it responds to #exception method that doesn't return an instance of Exception class" do
9296
e = Object.new
9397
def e.exception

0 commit comments

Comments
 (0)