Skip to content

Commit dc2f828

Browse files
committed
Add comment for the only valid usage of guard -> { respond_to? }
1 parent 711251a commit dc2f828

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

core/process/_fork_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
Process.respond_to?(:_fork).should == Process.respond_to?(:fork)
66
end
77

8+
# Using respond_to? in a guard here is OK because the correct semantics
9+
# are that _fork is implemented if and only if fork is (see above).
810
guard_not -> { Process.respond_to?(:fork) } do
911
it "raises a NotImplementedError when called" do
1012
-> { Process._fork }.should raise_error(NotImplementedError)

0 commit comments

Comments
 (0)