aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/io/reopen_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/io/reopen_spec.rb')
-rw-r--r--spec/ruby/core/io/reopen_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/ruby/core/io/reopen_spec.rb b/spec/ruby/core/io/reopen_spec.rb
index e769991554..53fcc9dede 100644
--- a/spec/ruby/core/io/reopen_spec.rb
+++ b/spec/ruby/core/io/reopen_spec.rb
@@ -162,6 +162,18 @@ describe "IO#reopen with a String" do
end
end
+ it "always resets the close-on-exec flag to true on non-STDIO objects" do
+ @io = new_io @name, "w"
+
+ @io.close_on_exec = true
+ @io.reopen @other_name
+ @io.close_on_exec?.should == true
+
+ @io.close_on_exec = false
+ @io.reopen @other_name
+ @io.close_on_exec?.should == true
+ end
+
it "creates the file if it doesn't exist if the IO is opened in write mode" do
@io = new_io @name, "w"
@@ -294,6 +306,18 @@ describe "IO#reopen with an IO" do
File.read(@other_name).should == "io data"
end
+ it "always resets the close-on-exec flag to true on non-STDIO objects" do
+ @other_io.close_on_exec = true
+ @io.close_on_exec = true
+ @io.reopen @other_io
+ @io.close_on_exec?.should == true
+
+ @other_io.close_on_exec = false
+ @io.close_on_exec = false
+ @io.reopen @other_io
+ @io.close_on_exec?.should == true
+ end
+
it "may change the class of the instance" do
@io.reopen @other_io
@io.should be_an_instance_of(File)