summaryrefslogtreecommitdiff
path: root/spec/ruby/core/process/status/termsig_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/process/status/termsig_spec.rb')
-rw-r--r--spec/ruby/core/process/status/termsig_spec.rb30
1 files changed, 17 insertions, 13 deletions
diff --git a/spec/ruby/core/process/status/termsig_spec.rb b/spec/ruby/core/process/status/termsig_spec.rb
index d4f55e2521..1d57724d12 100644
--- a/spec/ruby/core/process/status/termsig_spec.rb
+++ b/spec/ruby/core/process/status/termsig_spec.rb
@@ -1,39 +1,43 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
+require_relative '../../../spec_helper'
describe "Process::Status#termsig" do
-
describe "for a child that exited normally" do
-
before :each do
ruby_exe("exit(0)")
end
- it "returns true" do
- $?.termsig.should be_nil
+ it "returns nil" do
+ $?.termsig.should == nil
end
end
- describe "for a child that was sent a signal" do
-
+ describe "for a child that raised SignalException" do
before :each do
- ruby_exe("Process.kill(:KILL, $$); exit(42)")
+ ruby_exe("raise SignalException, 'SIGTERM'", exit_status: :SIGTERM)
end
platform_is_not :windows do
+ it "returns the signal" do
+ $?.termsig.should == Signal.list["TERM"]
+ end
+ end
+ end
+ describe "for a child that was sent a signal" do
+ before :each do
+ ruby_exe("Process.kill(:KILL, $$); exit(42)", exit_status: platform_is(:windows) ? 0 : :SIGKILL)
+ end
+
+ platform_is_not :windows do
it "returns the signal" do
$?.termsig.should == Signal.list["KILL"]
end
-
end
platform_is :windows do
-
it "always returns nil" do
- $?.termsig.should be_nil
+ $?.termsig.should == nil
end
-
end
-
end
end