Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 805422b

Browse files
committed
Add in_sub_process_if_possible (contd)
For specs where we care about not poisoning our environment it'd be good to run them in a subprocess, but these specs may be too important to skip on platforms without fork, so we can just run normally instead.
1 parent 252f8f0 commit 805422b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/rspec/support/spec/in_sub_process.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ def in_sub_process(prevent_warnings=true)
3535

3636
raise exception if exception
3737
end
38+
# rubocop:enable MethodLength
39+
alias :in_sub_process_if_possible :in_sub_process
3840
else
3941
def in_sub_process(*)
4042
skip "This spec requires forking to work properly, " \
4143
"and your platform does not support forking"
4244
end
45+
46+
def in_sub_process_if_possible(*)
47+
yield
48+
end
4349
end
44-
# rubocop:enable MethodLength
4550
end
4651
end
4752
end

0 commit comments

Comments
 (0)