2020-10-10 14:16:11 +02:00
|
|
|
# typed: false
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-08-17 22:42:37 -04:00
|
|
|
require "utils/fork"
|
|
|
|
|
|
|
|
describe Utils do
|
|
|
|
describe "#safe_fork" do
|
|
|
|
it "raises a RuntimeError on an error that isn't ErrorDuringExecution" do
|
|
|
|
expect {
|
|
|
|
described_class.safe_fork do
|
|
|
|
raise "this is an exception in the child"
|
|
|
|
end
|
|
|
|
}.to raise_error(RuntimeError)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "raises an ErrorDuringExecution on one in the child" do
|
|
|
|
expect {
|
|
|
|
described_class.safe_fork do
|
|
|
|
safe_system "/usr/bin/false"
|
|
|
|
end
|
|
|
|
}.to raise_error(ErrorDuringExecution)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|