summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io/getbyte_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/io/getbyte_spec.rb')
-rw-r--r--spec/ruby/core/io/getbyte_spec.rb22
1 files changed, 19 insertions, 3 deletions
diff --git a/spec/ruby/core/io/getbyte_spec.rb b/spec/ruby/core/io/getbyte_spec.rb
index cb8929890f..668d81519c 100644
--- a/spec/ruby/core/io/getbyte_spec.rb
+++ b/spec/ruby/core/io/getbyte_spec.rb
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
-require File.expand_path('../../../spec_helper', __FILE__)
-require File.expand_path('../fixtures/classes', __FILE__)
+require_relative '../../spec_helper'
+require_relative 'fixtures/classes'
describe "IO#getbyte" do
before :each do
@@ -23,7 +23,7 @@ describe "IO#getbyte" do
end
it "raises an IOError on closed stream" do
- lambda { IOSpecs.closed_io.getbyte }.should raise_error(IOError)
+ -> { IOSpecs.closed_io.getbyte }.should.raise(IOError)
end
end
@@ -40,3 +40,19 @@ describe "IO#getbyte" do
@io.getbyte.should == nil
end
end
+
+describe "IO#getbyte" do
+ before :each do
+ @name = tmp("io_getbyte.txt")
+ @io = new_io(@name, 'w')
+ end
+
+ after :each do
+ @io.close if @io
+ rm_r @name if @name
+ end
+
+ it "raises an IOError if the stream is not readable" do
+ -> { @io.getbyte }.should.raise(IOError)
+ end
+end