1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-06-27 15:51:37 +02:00
parent 64d8c0815e
commit b3fa158d1c
35 changed files with 652 additions and 56 deletions

View file

@ -23,11 +23,41 @@ describe "The rescue keyword" do
end.should == :caught
end
it "can capture the raised exception in a local variable" do
begin
raise SpecificExampleException, "some text"
rescue SpecificExampleException => e
e.message.should == "some text"
describe 'can capture the raised exception' do
before :all do
require_relative 'fixtures/rescue_captures'
end
it 'in a local variable' do
RescueSpecs::LocalVariableCaptor.should_capture_exception
end
it 'in a class variable' do
RescueSpecs::ClassVariableCaptor.should_capture_exception
end
it 'in a constant' do
RescueSpecs::ConstantCaptor.should_capture_exception
end
it 'in a global variable' do
RescueSpecs::GlobalVariableCaptor.should_capture_exception
end
it 'in an instance variable' do
RescueSpecs::InstanceVariableCaptor.should_capture_exception
end
it 'using a safely navigated setter method' do
RescueSpecs::SafeNavigationSetterCaptor.should_capture_exception
end
it 'using a setter method' do
RescueSpecs::SetterCaptor.should_capture_exception
end
it 'using a square brackets setter' do
RescueSpecs::SquareBracketsCaptor.should_capture_exception
end
end