summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io/new_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/io/new_spec.rb')
-rw-r--r--spec/ruby/core/io/new_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/ruby/core/io/new_spec.rb b/spec/ruby/core/io/new_spec.rb
new file mode 100644
index 0000000000..979ac0efcb
--- /dev/null
+++ b/spec/ruby/core/io/new_spec.rb
@@ -0,0 +1,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