diff --git a/lib/fakefs/file.rb b/lib/fakefs/file.rb index 55e727b..2739475 100644 --- a/lib/fakefs/file.rb +++ b/lib/fakefs/file.rb @@ -237,9 +237,7 @@ module FakeFS raise NotImplementedError end - def to_i - raise NotImplementedError - end + alias_method :to_i, :fileno def to_io self diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index 9e25aa9..15ef168 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -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|