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