diff options
Diffstat (limited to 'spec/ruby/core/io/open_spec.rb')
| -rw-r--r-- | spec/ruby/core/io/open_spec.rb | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/ruby/core/io/open_spec.rb b/spec/ruby/core/io/open_spec.rb index d3a3961df7..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,7 +72,7 @@ describe "IO.open" do raise StandardError end end - end.should raise_error(StandardError) + end.should.raise(StandardError) ScratchPad.recorded.should == :called end |
