Skip to content

Commit 92cbcfa

Browse files
author
Lillian Zhang
committed
Add a spec for Kernel#sleep
1 parent c20f80b commit 92cbcfa

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

spec/ruby/core/kernel/sleep_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
sleep(Rational(1, 999)).should >= 0
2323
end
2424

25+
it "accepts any Object that reponds to divmod" do
26+
o = Object.new
27+
def o.divmod(*); [1,0.2]; end
28+
sleep(o).should >= 0
29+
end
30+
2531
it "raises an ArgumentError when passed a negative duration" do
2632
-> { sleep(-0.1) }.should raise_error(ArgumentError)
2733
-> { sleep(-1) }.should raise_error(ArgumentError)

0 commit comments

Comments
 (0)