summaryrefslogtreecommitdiff
path: root/spec/ruby/core/file/shared/unlink.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/file/shared/unlink.rb')
-rw-r--r--spec/ruby/core/file/shared/unlink.rb26
1 files changed, 12 insertions, 14 deletions
diff --git a/spec/ruby/core/file/shared/unlink.rb b/spec/ruby/core/file/shared/unlink.rb
index 7b0413b76b..0032907ba2 100644
--- a/spec/ruby/core/file/shared/unlink.rb
+++ b/spec/ruby/core/file/shared/unlink.rb
@@ -21,21 +21,21 @@ describe :file_unlink, shared: true do
it "deletes a single file" do
File.send(@method, @file1).should == 1
- File.exist?(@file1).should == false
+ File.should_not.exist?(@file1)
end
it "deletes multiple files" do
File.send(@method, @file1, @file2).should == 2
- File.exist?(@file1).should == false
- File.exist?(@file2).should == false
+ File.should_not.exist?(@file1)
+ File.should_not.exist?(@file2)
end
it "raises a TypeError if not passed a String type" do
- lambda { File.send(@method, 1) }.should raise_error(TypeError)
+ -> { File.send(@method, 1) }.should.raise(TypeError)
end
it "raises an Errno::ENOENT when the given file doesn't exist" do
- lambda { File.send(@method, 'bogus') }.should raise_error(Errno::ENOENT)
+ -> { File.send(@method, 'bogus') }.should.raise(Errno::ENOENT)
end
it "coerces a given parameter into a string if possible" do
@@ -48,16 +48,14 @@ describe :file_unlink, shared: true do
File.send(@method, mock_to_path(@file1)).should == 1
end
- ruby_version_is "2.3" do
- platform_is :windows do
- it "allows deleting an open file with File::SHARE_DELETE" do
- path = tmp("share_delete.txt")
- File.open(path, mode: File::CREAT | File::WRONLY | File::BINARY | File::SHARE_DELETE) do |f|
- File.exist?(path).should be_true
- File.send(@method, path)
- end
- File.exist?(path).should be_false
+ platform_is :windows do
+ it "allows deleting an open file with File::SHARE_DELETE" do
+ path = tmp("share_delete.txt")
+ File.open(path, mode: File::CREAT | File::WRONLY | File::BINARY | File::SHARE_DELETE) do |f|
+ File.should.exist?(path)
+ File.send(@method, path)
end
+ File.should_not.exist?(path)
end
end
end