From 14367140a32752ff44d4ab4afde340a5c58b8298 Mon Sep 17 00:00:00 2001 From: Ryan McGeary Date: Wed, 27 Jul 2011 21:59:56 -0400 Subject: [PATCH] Added basic File#to_path support (Closes #92) --- lib/fakefs/file.rb | 2 +- test/fakefs_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/fakefs/file.rb b/lib/fakefs/file.rb index 01931c6..3c42208 100644 --- a/lib/fakefs/file.rb +++ b/lib/fakefs/file.rb @@ -358,7 +358,7 @@ module FakeFS end def to_path - raise NotImplementedError + @path end end diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index cc0041c..732c1d2 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -1663,5 +1663,11 @@ class FakeFSTest < Test::Unit::TestCase assert_equal false, f.autoclose? end end + + def test_to_path + File.new("foo", 'w') do |f| + assert_equal "foo", f.to_path + end + end end end