summaryrefslogtreecommitdiff
path: root/spec/ruby/library/io-wait/wait_readable_spec.rb
blob: 06ffbda5c88bc2ea424799fce43e0ea8fb9a76af (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
26
27
require_relative '../../spec_helper'

ruby_version_is ''...'3.2' do
  require 'io/wait'
end

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