aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/file/stat/nlink_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/file/stat/nlink_spec.rb')
-rw-r--r--spec/ruby/core/file/stat/nlink_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/ruby/core/file/stat/nlink_spec.rb b/spec/ruby/core/file/stat/nlink_spec.rb
new file mode 100644
index 0000000000..e857b07fd1
--- /dev/null
+++ b/spec/ruby/core/file/stat/nlink_spec.rb
@@ -0,0 +1,21 @@
+require File.expand_path('../../../../spec_helper', __FILE__)
+
+describe "File::Stat#nlink" do
+ before :each do
+ @file = tmp("stat_nlink")
+ @link = @file + ".lnk"
+ touch @file
+ end
+
+ after :each do
+ rm_r @link, @file
+ end
+
+ platform_is_not :windows do
+ it "returns the number of links to a file" do
+ File::Stat.new(@file).nlink.should == 1
+ File.link(@file, @link)
+ File::Stat.new(@file).nlink.should == 2
+ end
+ end
+end