diff options
Diffstat (limited to 'spec/ruby/core/io/reopen_spec.rb')
| -rw-r--r-- | spec/ruby/core/io/reopen_spec.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/ruby/core/io/reopen_spec.rb b/spec/ruby/core/io/reopen_spec.rb index 8ff0f217f4..3b972d8978 100644 --- a/spec/ruby/core/io/reopen_spec.rb +++ b/spec/ruby/core/io/reopen_spec.rb @@ -27,35 +27,35 @@ describe "IO#reopen" do it "changes the class of the instance to the class of the object returned by #to_io" do obj = mock("io") obj.should_receive(:to_io).and_return(@other_io) - @io.reopen(obj).should be_an_instance_of(File) + @io.reopen(obj).should.instance_of?(File) end it "raises an IOError if the object returned by #to_io is closed" do obj = mock("io") obj.should_receive(:to_io).and_return(IOSpecs.closed_io) - -> { @io.reopen obj }.should raise_error(IOError) + -> { @io.reopen obj }.should.raise(IOError) end it "raises a TypeError if #to_io does not return an IO instance" do obj = mock("io") obj.should_receive(:to_io).and_return("something else") - -> { @io.reopen obj }.should raise_error(TypeError) + -> { @io.reopen obj }.should.raise(TypeError) end it "raises an IOError when called on a closed stream with an object" do @io.close obj = mock("io") obj.should_not_receive(:to_io) - -> { @io.reopen(STDOUT) }.should raise_error(IOError) + -> { @io.reopen(STDOUT) }.should.raise(IOError) end it "raises an IOError if the IO argument is closed" do - -> { @io.reopen(IOSpecs.closed_io) }.should raise_error(IOError) + -> { @io.reopen(IOSpecs.closed_io) }.should.raise(IOError) end it "raises an IOError when called on a closed stream with an IO" do @io.close - -> { @io.reopen(STDOUT) }.should raise_error(IOError) + -> { @io.reopen(STDOUT) }.should.raise(IOError) end end @@ -77,12 +77,12 @@ describe "IO#reopen with a String" do it "does not raise an exception when called on a closed stream with a path" do @io.close @io.reopen @name, "r" - @io.closed?.should be_false + @io.closed?.should == false @io.gets.should == "Line 1: One\n" end it "returns self" do - @io.reopen(@name).should equal(@io) + @io.reopen(@name).should.equal?(@io) end it "positions a newly created instance at the beginning of the new stream" do @@ -188,7 +188,7 @@ describe "IO#reopen with a String" do it "raises an Errno::ENOENT if the file does not exist and the IO is not opened in write mode" do @io = new_io @name, "r" - -> { @io.reopen(@other_name) }.should raise_error(Errno::ENOENT) + -> { @io.reopen(@other_name) }.should.raise(Errno::ENOENT) end end @@ -214,9 +214,9 @@ describe "IO#reopen with an IO at EOF" do end it "resets the EOF status to false" do - @io.eof?.should be_true + @io.eof?.should == true @io.reopen @other_io - @io.eof?.should be_false + @io.eof?.should == false end end @@ -244,7 +244,7 @@ describe "IO#reopen with an IO" do # MRI actually changes the class of @io in the call to #reopen # but does not preserve the existing singleton class of @io. def @io.to_io; flunk; end - @io.reopen(@other_io).should be_an_instance_of(IO) + @io.reopen(@other_io).should.instance_of?(IO) end it "does not change the object_id" do @@ -303,7 +303,7 @@ describe "IO#reopen with an IO" do it "may change the class of the instance" do @io.reopen @other_io - @io.should be_an_instance_of(File) + @io.should.instance_of?(File) end it "sets path equals to the other IO's path if other IO is File" do |
