Add File#to_i (an alias for fileno)

This commit is contained in:
Scott Taylor 2009-11-08 01:17:42 -05:00
parent 1e685ed25e
commit 02b76af287
2 changed files with 6 additions and 3 deletions

View File

@ -237,9 +237,7 @@ module FakeFS
raise NotImplementedError
end
def to_i
raise NotImplementedError
end
alias_method :to_i, :fileno
def to_io
self

View File

@ -369,6 +369,11 @@ class FakeFSTest < Test::Unit::TestCase
assert_equal f, f.to_io
end
def test_File_to_i_is_alias_for_filno
f = File.open("/foo", "w")
assert_equal f.method(:to_i), f.method(:fileno)
end
def test_knows_symlink_files_are_files
path = '/path/to/file.txt'
File.open(path, 'w') do |f|