summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/process/exit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/shared/process/exit.rb')
-rw-r--r--spec/ruby/shared/process/exit.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/ruby/shared/process/exit.rb b/spec/ruby/shared/process/exit.rb
index ae8abaea40..1e073614a3 100644
--- a/spec/ruby/shared/process/exit.rb
+++ b/spec/ruby/shared/process/exit.rb
@@ -21,6 +21,12 @@ describe :process_exit, shared: true do
end
end
+ it "raises a SystemExit with message 'exit'" do
+ -> { @object.exit }.should raise_error(SystemExit) { |e|
+ e.message.should == "exit"
+ }
+ end
+
it "tries to convert the passed argument to an Integer using #to_int" do
obj = mock('5')
obj.should_receive(:to_int).and_return(5)
@@ -98,6 +104,12 @@ describe :process_exit!, shared: true do
$?.exitstatus.should == 21
end
+ it "skips ensure clauses" do
+ out = ruby_exe("begin; STDERR.puts 'before'; #{@object}.send(:exit!, 21); ensure; STDERR.puts 'ensure'; end", args: '2>&1', exit_status: 21)
+ out.should == "before\n"
+ $?.exitstatus.should == 21
+ end
+
it "overrides the original exception and exit status when called from #at_exit" do
code = <<-RUBY
at_exit do