diff options
Diffstat (limited to 'spec/ruby/core/io/open_spec.rb')
| -rw-r--r-- | spec/ruby/core/io/open_spec.rb | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/spec/ruby/core/io/open_spec.rb b/spec/ruby/core/io/open_spec.rb index 94df5a5ef6..ff22d14685 100644 --- a/spec/ruby/core/io/open_spec.rb +++ b/spec/ruby/core/io/open_spec.rb @@ -32,11 +32,24 @@ describe "IO.open" do super() ScratchPad.record :called end - io.closed?.should be_false + io.closed?.should == false end ScratchPad.recorded.should == :called end + it "propagate an exception in the block after calling #close" do + -> do + IO.open(@fd, "w") do |io| + IOSpecs.io_mock(io, :close) do + super() + ScratchPad.record :called + end + raise Exception + end + end.should.raise(Exception) + ScratchPad.recorded.should == :called + end + it "propagates an exception raised by #close that is not a StandardError" do -> do IO.open(@fd, "w") do |io| @@ -46,7 +59,7 @@ describe "IO.open" do raise Exception end end - end.should raise_error(Exception) + end.should.raise(Exception) ScratchPad.recorded.should == :called end @@ -59,11 +72,11 @@ describe "IO.open" do raise StandardError end end - end.should raise_error(StandardError) + end.should.raise(StandardError) ScratchPad.recorded.should == :called end - it "does not propagate a IOError with 'closed stream' message raised by #close" do + it "does not propagate an IOError with 'closed stream' message raised by #close" do IO.open(@fd, "w") do |io| IOSpecs.io_mock(io, :close) do super() @@ -74,7 +87,7 @@ describe "IO.open" do ScratchPad.recorded.should == :called end - it "does not set last error when a IOError with 'closed stream' raised by #close" do + it "does not set last error when an IOError with 'closed stream' raised by #close" do IO.open(@fd, "w") do |io| IOSpecs.io_mock(io, :close) do super() |
