From 31597f583651c4d9df56b4ffc23265a3daa7f691 Mon Sep 17 00:00:00 2001 From: Aaron Suggs Date: Tue, 12 Jan 2010 13:50:08 -0500 Subject: [PATCH] File.join delegates to RealFile.join. Closes #31 --- lib/fakefs/file.rb | 2 +- test/fake/file/join_test.rb | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/fake/file/join_test.rb diff --git a/lib/fakefs/file.rb b/lib/fakefs/file.rb index 4711186..6e05fb4 100644 --- a/lib/fakefs/file.rb +++ b/lib/fakefs/file.rb @@ -33,7 +33,7 @@ module FakeFS end def self.join(*parts) - parts * PATH_SEPARATOR + RealFile.join(parts) end def self.exist?(path) diff --git a/test/fake/file/join_test.rb b/test/fake/file/join_test.rb new file mode 100644 index 0000000..966273a --- /dev/null +++ b/test/fake/file/join_test.rb @@ -0,0 +1,19 @@ +require "test_helper" + +class FileJoin < Test::Unit::TestCase + def setup + FakeFS.activate! + end + + def teardown + FakeFS.deactivate! + end + + [ + ["a", "b"], ["a/", "b"], ["a", "/b"], ["a/", "/b"], ["a", "/", "b"] + ].each_with_index do |args, i| + define_method "test_file_join_#{i}" do + assert_equal RealFile.join(args), File.join(args) + end + end +end \ No newline at end of file