We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aa6c9d6 commit cc79c2fCopy full SHA for cc79c2f
core/kernel/raise_spec.rb
@@ -27,6 +27,27 @@
27
28
ScratchPad.recorded.should be_nil
29
end
30
+
31
+ ruby_version_is "2.6" do
32
+ it "accepts a cause keyword argument that sets the cause" do
33
+ cause = StandardError.new
34
+ -> { raise("error", cause: cause) }.should raise_error(RuntimeError) { |e| e.cause.should == cause }
35
+ end
36
37
+ it "accepts a cause keyword argument that overrides the last exception" do
38
+ begin
39
+ raise "first raise"
40
+ rescue => e
41
42
43
44
45
46
+ it "raises an ArgumentError when only cause is given" do
47
48
+ -> { raise(cause: cause) }.should raise_error(ArgumentError)
49
50
51
52
53
describe "Kernel#raise" do
0 commit comments