Skip to content
Browse files

implement File::Stat#size

  • Loading branch information...
1 parent ccb97a7 commit ce41ca74dd0264f4007775c8292387b62bf0c574 @mislav committed Nov 27, 2009
Showing with 9 additions and 0 deletions.
  1. +4 −0 lib/fakefs/file.rb
  2. +5 −0 test/file/stat_test.rb
View
4 lib/fakefs/file.rb
@@ -192,6 +192,10 @@ def directory?
def nlink
FileSystem.find(@file).links.size
end
+
+ def size
+ File.size(@file)
+ end
end
attr_reader :path
View
5 test/file/stat_test.rb
@@ -67,4 +67,9 @@ def test_two_hard_links_show_nlinks_as_two
assert_equal 2, File.stat("testfile").nlink
end
+
+ def test_file_size
+ File.open('testfile', 'w') { |f| f << 'test' }
+ assert_equal 4, File.stat('testfile').size
+ end
end

0 comments on commit ce41ca7

Please sign in to comment.
Something went wrong with that request. Please try again.