summaryrefslogtreecommitdiff
path: root/spec/ruby/shared/file/identical.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/shared/file/identical.rb')
-rw-r--r--spec/ruby/shared/file/identical.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/spec/ruby/shared/file/identical.rb b/spec/ruby/shared/file/identical.rb
index ecc21727ca..628abd4f48 100644
--- a/spec/ruby/shared/file/identical.rb
+++ b/spec/ruby/shared/file/identical.rb
@@ -9,7 +9,11 @@ describe :file_identical, shared: true do
touch(@file2) { |f| f.puts "file2" }
rm_r @link
- File.link(@file1, @link)
+ begin
+ File.link(@file1, @link)
+ rescue Errno::EACCES
+ File.symlink(@file1, @link)
+ end
end
after :each do
@@ -21,9 +25,9 @@ describe :file_identical, shared: true do
end
it "returns false if any of the files doesn't exist" do
- @object.send(@method, @file1, @non_exist).should be_false
- @object.send(@method, @non_exist, @file1).should be_false
- @object.send(@method, @non_exist, @non_exist).should be_false
+ @object.send(@method, @file1, @non_exist).should == false
+ @object.send(@method, @non_exist, @file1).should == false
+ @object.send(@method, @non_exist, @non_exist).should == false
end
it "accepts an object that has a #to_path method" do
@@ -31,17 +35,17 @@ describe :file_identical, shared: true do
end
it "raises an ArgumentError if not passed two arguments" do
- -> { @object.send(@method, @file1, @file2, @link) }.should raise_error(ArgumentError)
- -> { @object.send(@method, @file1) }.should raise_error(ArgumentError)
+ -> { @object.send(@method, @file1, @file2, @link) }.should.raise(ArgumentError)
+ -> { @object.send(@method, @file1) }.should.raise(ArgumentError)
end
it "raises a TypeError if not passed String types" do
- -> { @object.send(@method, 1,1) }.should raise_error(TypeError)
+ -> { @object.send(@method, 1,1) }.should.raise(TypeError)
end
it "returns true if both named files are identical" do
- @object.send(@method, @file1, @file1).should be_true
- @object.send(@method, @link, @link).should be_true
- @object.send(@method, @file1, @file2).should be_false
+ @object.send(@method, @file1, @file1).should == true
+ @object.send(@method, @link, @link).should == true
+ @object.send(@method, @file1, @file2).should == false
end
end