File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
spec/ruby/library/io-wait Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ require_relative '../../spec_helper'
2
+
3
+ require 'io/wait'
4
+
5
+ describe "IO#wait_readable" do
6
+ before :each do
7
+ @io = File . new ( __FILE__ )
8
+ end
9
+
10
+ after :each do
11
+ @io . close
12
+ end
13
+
14
+ it "waits for the IO to become readable with no timeout" do
15
+ @io . wait_readable . should == @io
16
+ end
17
+
18
+ it "waits for the IO to become readable with the given timeout" do
19
+ @io . wait_readable ( 1 ) . should == @io
20
+ end
21
+
22
+ it "waits for the IO to become readable with the given large timeout" do
23
+ @io . wait_readable ( 365 * 24 * 60 * 60 ) . should == @io
24
+ end
25
+ end
Original file line number Diff line number Diff line change
1
+ require_relative '../../spec_helper'
2
+
3
+ require 'io/wait'
4
+
5
+ describe "IO#wait_writable" do
6
+ it "waits for the IO to become writable with no timeout" do
7
+ STDOUT . wait_writable . should == STDOUT
8
+ end
9
+
10
+ it "waits for the IO to become writable with the given timeout" do
11
+ STDOUT . wait_writable ( 1 ) . should == STDOUT
12
+ end
13
+
14
+ it "waits for the IO to become writable with the given large timeout" do
15
+ # Represents one year and is larger than a 32-bit int
16
+ STDOUT . wait_writable ( 365 * 24 * 60 * 60 ) . should == STDOUT
17
+ end
18
+ end
You can’t perform that action at this time.
0 commit comments