summaryrefslogtreecommitdiff
path: root/spec/ruby/library/io-wait/wait_readable_spec.rb
blob: 48e0b4ef7d2f41f558656e36ccb00df6092577e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require_relative '../../spec_helper'

require 'io/wait'

describe "IO#wait_readable" do
  before :each do
    @io = File.new(__FILE__ )
  end

  after :each do
    @io.close
  end

  it "waits for the IO to become readable with no timeout" do
    @io.wait_readable.should == @io
  end

  it "waits for the IO to become readable with the given timeout" do
    @io.wait_readable(1).should == @io
  end

  it "waits for the IO to become readable with the given large timeout" do
    @io.wait_readable(365 * 24 * 60 * 60).should == @io
  end
end