summaryrefslogtreecommitdiff
path: root/spec/ruby/core/process/daemon_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/process/daemon_spec.rb')
-rw-r--r--spec/ruby/core/process/daemon_spec.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/ruby/core/process/daemon_spec.rb b/spec/ruby/core/process/daemon_spec.rb
index f68ddfe253..7198dfa6ee 100644
--- a/spec/ruby/core/process/daemon_spec.rb
+++ b/spec/ruby/core/process/daemon_spec.rb
@@ -1,7 +1,11 @@
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/common', __FILE__)
-
-platform_is_not :windows do
+require_relative '../../spec_helper'
+require_relative 'fixtures/common'
+
+guard -> {
+ Process.respond_to?(:fork) and
+ # macOS 15 is not working for these examples
+ !(/darwin/ =~ RUBY_PLATFORM && /15/ =~ `sw_vers -productVersion`)
+} do
describe :process_daemon_keep_stdio_open_false, shared: true do
it "redirects stdout to /dev/null" do
@daemon.invoke("keep_stdio_open_false_stdout", @object).should == ""
@@ -86,10 +90,6 @@ platform_is_not :windows do
@daemon.invoke("stay_in_dir", [true]).should == @invoke_dir
end
- it "does not change to the root directory if the first argument is non-false" do
- @daemon.invoke("stay_in_dir", [:yes]).should == @invoke_dir
- end
-
describe "when the second argument is not given" do
it_behaves_like :process_daemon_keep_stdio_open_false, nil, [false]
end
@@ -105,19 +105,19 @@ platform_is_not :windows do
describe "when the second argument is true" do
it_behaves_like :process_daemon_keep_stdio_open_true, nil, [false, true]
end
-
- describe "when the second argument is non-false" do
- it_behaves_like :process_daemon_keep_stdio_open_true, nil, [false, :yes]
- end
end
end
-platform_is :windows do
+guard_not -> { Process.respond_to?(:fork) } do
describe "Process.daemon" do
+ it "returns false from #respond_to?" do
+ Process.respond_to?(:daemon).should == false
+ end
+
it "raises a NotImplementedError" do
- lambda {
+ -> {
Process.daemon
- }.should raise_error(NotImplementedError)
+ }.should.raise(NotImplementedError)
end
end
end