Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add specs for Process._fork #968

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions core/process/_fork_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require_relative '../../spec_helper'

describe "Process._fork" do
ruby_version_is ""..."3.1" do
it "raises NoMethodError" do
-> { Process._fork }.should raise_error(NoMethodError)
end
end

ruby_version_is "3.1" do
platform_is :windows do
it "returns false from #respond_to?" do
Process.respond_to?(:_fork).should be_false
end

it "raises a NotImplementedError when called" do
-> { Process._fork }.should raise_error(NotImplementedError)
end
end

platform_is_not :windows do
it "returns true from #respond_to?" do
Process.respond_to?(:_fork).should be_true
end

it "is called by Process#fork" do
Process.should_receive(:_fork).once.and_return(42)

pid = Process.fork {}
pid.should equal(42)
end
end
end
end