summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io/new_spec.rb
blob: 979ac0efcbd78f05495263d52f7f4b22267247c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require_relative '../../spec_helper'
require_relative 'shared/new'

# NOTE: should be synchronized with library/stringio/initialize_spec.rb

describe "IO.new" do
  it_behaves_like :io_new, :new

  it "does not use the given block and warns to use IO::open" do
    -> {
      @io = IO.send(@method, @fd) { raise }
    }.should complain(/warning: IO::new\(\) does not take block; use IO::open\(\) instead/)
  end
end

describe "IO.new" do
  it_behaves_like :io_new_errors, :new
end