From 1e685ed25ee8e50c58edcf9e97475ecaf030c070 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sun, 8 Nov 2009 01:13:28 -0500 Subject: [PATCH] Implement File#to_io --- lib/fakefs/file.rb | 2 +- test/fakefs_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/fakefs/file.rb b/lib/fakefs/file.rb index 6836c8b..55e727b 100644 --- a/lib/fakefs/file.rb +++ b/lib/fakefs/file.rb @@ -242,7 +242,7 @@ module FakeFS end def to_io - raise NotImplementedError + self end def write_nonblock(string) diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index cb396d6..9e25aa9 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -364,6 +364,11 @@ class FakeFSTest < Test::Unit::TestCase assert File.file?(path) end + def test_File_io_returns_self + f = File.open("/foo", "w") + assert_equal f, f.to_io + end + def test_knows_symlink_files_are_files path = '/path/to/file.txt' File.open(path, 'w') do |f|