diff --git a/optional/capi/io_spec.rb b/optional/capi/io_spec.rb index a34b3a4ff..dd3366427 100644 --- a/optional/capi/io_spec.rb +++ b/optional/capi/io_spec.rb @@ -579,11 +579,13 @@ end it "does not apply the specified encoding flags" do - File.write("a.txt", "123\r\n456\n89") - file = File.open("a.txt", "r") + File.write(@name, "123\r\n456\n89") + file = File.open(@name, "r") io = @o.rb_io_open_descriptor(File, file.fileno, CApiIOSpecs::FMODE_READABLE, "a.txt", 60, "US-ASCII", "UTF-8", CApiIOSpecs::ECONV_UNIVERSAL_NEWLINE_DECORATOR, {}) io.read_nonblock(20).should == "123\r\n456\n89" + ensure + file.close end it "ignores the IO open options" do @@ -623,7 +625,13 @@ io = @o.rb_io_open_descriptor(File, @w_io.fileno, CApiIOSpecs::FMODE_READABLE, "a.txt", 60, "US-ASCII", "UTF-8", 0, {}) io.should.is_a?(File) - -> { io.read_nonblock(1) }.should raise_error(Errno::EBADF) + platform_is_not :windows do + -> { io.read_nonblock(1) }.should raise_error(Errno::EBADF) + end + + platform_is :windows do + -> { io.read_nonblock(1) }.should raise_error(IO::EWOULDBLOCKWaitReadable) + end end it "tolerates NULL as rb_io_encoding *encoding parameter" do