mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@07164da
This commit is contained in:
parent
7429841ab6
commit
126fd5f15c
38 changed files with 733 additions and 44 deletions
|
@ -25,6 +25,14 @@ describe :kernel_raise, shared: true do
|
|||
-> { @object.raise("a bad thing") }.should raise_error(RuntimeError)
|
||||
end
|
||||
|
||||
it "passes no arguments to the constructor when given only an exception class" do
|
||||
klass = Class.new(Exception) do
|
||||
def initialize
|
||||
end
|
||||
end
|
||||
-> { @object.raise(klass) }.should raise_error(klass) { |e| e.message.should == klass.to_s }
|
||||
end
|
||||
|
||||
it "raises a TypeError when passed a non-Exception object" do
|
||||
-> { @object.raise(Object.new) }.should raise_error(TypeError)
|
||||
end
|
||||
|
@ -41,25 +49,6 @@ describe :kernel_raise, shared: true do
|
|||
-> { @object.raise(nil) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "re-raises the previously rescued exception if no exception is specified" do
|
||||
-> do
|
||||
begin
|
||||
@object.raise Exception, "outer"
|
||||
ScratchPad.record :no_abort
|
||||
rescue
|
||||
begin
|
||||
@object.raise StandardError, "inner"
|
||||
rescue
|
||||
end
|
||||
|
||||
@object.raise
|
||||
ScratchPad.record :no_reraise
|
||||
end
|
||||
end.should raise_error(Exception, "outer")
|
||||
|
||||
ScratchPad.recorded.should be_nil
|
||||
end
|
||||
|
||||
it "re-raises a previously rescued exception without overwriting the backtrace" do
|
||||
begin
|
||||
initial_raise_line = __LINE__; @object.raise 'raised'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue