Implemented File.size
This commit is contained in:
parent
0da41d92a7
commit
a34f8e8beb
@ -18,6 +18,10 @@ module FakeFS
|
||||
alias_method :exists?, :exist?
|
||||
end
|
||||
|
||||
def self.size(path)
|
||||
read(path).length
|
||||
end
|
||||
|
||||
def self.const_missing(name)
|
||||
RealFile.const_get(name)
|
||||
end
|
||||
|
@ -113,6 +113,14 @@ class FakeFSTest < Test::Unit::TestCase
|
||||
assert_equal 'Yada Yada', File.read(path)
|
||||
end
|
||||
|
||||
def test_can_get_size_of_files
|
||||
path = '/path/to/file.txt'
|
||||
File.open(path, 'w') do |f|
|
||||
f << 'Yada Yada'
|
||||
end
|
||||
assert_equal 9, File.size(path)
|
||||
end
|
||||
|
||||
def test_can_read_with_File_readlines
|
||||
path = '/path/to/file.txt'
|
||||
File.open(path, 'w') do |f|
|
||||
|
Loading…
Reference in New Issue
Block a user