summaryrefslogtreecommitdiff
path: root/spec/ruby/library/stringio/truncate_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/stringio/truncate_spec.rb')
-rw-r--r--spec/ruby/library/stringio/truncate_spec.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/ruby/library/stringio/truncate_spec.rb b/spec/ruby/library/stringio/truncate_spec.rb
index e8d7f1a15d..7205261141 100644
--- a/spec/ruby/library/stringio/truncate_spec.rb
+++ b/spec/ruby/library/stringio/truncate_spec.rb
@@ -3,11 +3,11 @@ require "stringio"
describe "StringIO#truncate when passed [length]" do
before :each do
- @io = StringIO.new('123456789')
+ @io = StringIO.new(+'123456789')
end
it "returns an Integer" do
- @io.truncate(4).should be_kind_of(Integer)
+ @io.truncate(4).should.is_a?(Integer)
end
it "truncated the underlying string down to the passed length" do
@@ -16,15 +16,15 @@ describe "StringIO#truncate when passed [length]" do
end
it "does not create a copy of the underlying string" do
- io = StringIO.new(str = "123456789")
+ io = StringIO.new(str = +"123456789")
io.truncate(4)
- io.string.should equal(str)
+ io.string.should.equal?(str)
end
it "does not change the position" do
@io.pos = 7
@io.truncate(4)
- @io.pos.should eql(7)
+ @io.pos.should.eql?(7)
end
it "can grow a string to a larger size, padding it with \\000" do
@@ -33,8 +33,8 @@ describe "StringIO#truncate when passed [length]" do
end
it "raises an Errno::EINVAL when the passed length is negative" do
- -> { @io.truncate(-1) }.should raise_error(Errno::EINVAL)
- -> { @io.truncate(-10) }.should raise_error(Errno::EINVAL)
+ -> { @io.truncate(-1) }.should.raise(Errno::EINVAL)
+ -> { @io.truncate(-10) }.should.raise(Errno::EINVAL)
end
it "tries to convert the passed length to an Integer using #to_int" do
@@ -46,17 +46,17 @@ describe "StringIO#truncate when passed [length]" do
end
it "raises a TypeError when the passed length can't be converted to an Integer" do
- -> { @io.truncate(Object.new) }.should raise_error(TypeError)
+ -> { @io.truncate(Object.new) }.should.raise(TypeError)
end
end
describe "StringIO#truncate when self is not writable" do
it "raises an IOError" do
- io = StringIO.new("test", "r")
- -> { io.truncate(2) }.should raise_error(IOError)
+ io = StringIO.new(+"test", "r")
+ -> { io.truncate(2) }.should.raise(IOError)
- io = StringIO.new("test")
+ io = StringIO.new(+"test")
io.close_write
- -> { io.truncate(2) }.should raise_error(IOError)
+ -> { io.truncate(2) }.should.raise(IOError)
end
end