diff options
Diffstat (limited to 'spec/ruby/core/file/truncate_spec.rb')
| -rw-r--r-- | spec/ruby/core/file/truncate_spec.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/spec/ruby/core/file/truncate_spec.rb b/spec/ruby/core/file/truncate_spec.rb index b4a2e3e577..5f37f34155 100644 --- a/spec/ruby/core/file/truncate_spec.rb +++ b/spec/ruby/core/file/truncate_spec.rb @@ -54,29 +54,29 @@ describe "File.truncate" do rm_r not_existing_file begin - -> { File.truncate(not_existing_file, 5) }.should raise_error(Errno::ENOENT) + -> { File.truncate(not_existing_file, 5) }.should.raise(Errno::ENOENT) ensure rm_r not_existing_file end end it "raises an ArgumentError if not passed two arguments" do - -> { File.truncate }.should raise_error(ArgumentError) - -> { File.truncate(@name) }.should raise_error(ArgumentError) + -> { File.truncate }.should.raise(ArgumentError) + -> { File.truncate(@name) }.should.raise(ArgumentError) end platform_is_not :netbsd, :openbsd do it "raises an Errno::EINVAL if the length argument is not valid" do - -> { File.truncate(@name, -1) }.should raise_error(Errno::EINVAL) # May fail + -> { File.truncate(@name, -1) }.should.raise(Errno::EINVAL) # May fail end end it "raises a TypeError if not passed a String type for the first argument" do - -> { File.truncate(1, 1) }.should raise_error(TypeError) + -> { File.truncate(1, 1) }.should.raise(TypeError) end it "raises a TypeError if not passed an Integer type for the second argument" do - -> { File.truncate(@name, nil) }.should raise_error(TypeError) + -> { File.truncate(@name, nil) }.should.raise(TypeError) end it "accepts an object that has a #to_path method" do @@ -149,29 +149,29 @@ describe "File#truncate" do end it "raises an ArgumentError if not passed one argument" do - -> { @file.truncate }.should raise_error(ArgumentError) - -> { @file.truncate(1) }.should_not raise_error(ArgumentError) + -> { @file.truncate }.should.raise(ArgumentError) + -> { @file.truncate(1) }.should_not.raise(ArgumentError) end platform_is_not :netbsd do it "raises an Errno::EINVAL if the length argument is not valid" do - -> { @file.truncate(-1) }.should raise_error(Errno::EINVAL) # May fail + -> { @file.truncate(-1) }.should.raise(Errno::EINVAL) # May fail end end it "raises an IOError if file is closed" do @file.close @file.should.closed? - -> { @file.truncate(42) }.should raise_error(IOError) + -> { @file.truncate(42) }.should.raise(IOError) end it "raises an IOError if file is not opened for writing" do File.open(@name, 'r') do |file| - -> { file.truncate(42) }.should raise_error(IOError) + -> { file.truncate(42) }.should.raise(IOError) end end it "raises a TypeError if not passed an Integer type for the for the argument" do - -> { @file.truncate(nil) }.should raise_error(TypeError) + -> { @file.truncate(nil) }.should.raise(TypeError) end end |
