we can now clone even hard to find dotfiles
This commit is contained in:
parent
364dc66ee5
commit
8aba1ad6a5
@ -231,8 +231,7 @@ module FakeFS
|
||||
def clone(path)
|
||||
path = File.expand_path(path)
|
||||
pattern = File.join(path, '**', '*')
|
||||
dot_pattern = File.join(path, '**', '.*')
|
||||
files = RealFile.file?(path) ? [path] : [path] + RealDir.glob([pattern, dot_pattern])
|
||||
files = RealFile.file?(path) ? [path] : [path] + RealDir.glob(pattern, RealFile::FNM_DOTMATCH)
|
||||
|
||||
files.each do |f|
|
||||
if RealFile.file?(f)
|
||||
|
@ -364,11 +364,13 @@ class FakeFSTest < Test::Unit::TestCase
|
||||
RealFileUtils.rm_rf(here('subdir')) if RealFile.exists?(here('subdir'))
|
||||
end
|
||||
|
||||
def test_clone_clones_dot_files
|
||||
RealFileUtils.mkdir_p(here('subdir/.bar'))
|
||||
def test_clone_clones_dot_files_even_hard_to_find_ones
|
||||
RealFileUtils.mkdir_p(here('subdir/.bar/baz/.quux/foo'))
|
||||
assert !File.exists?(here('subdir'))
|
||||
|
||||
FileSystem.clone(here('subdir'))
|
||||
assert_equal ['.bar'], FileSystem.find(here('subdir')).keys
|
||||
assert_equal ['foo'], FileSystem.find(here('subdir/.bar/baz/.quux')).keys
|
||||
ensure
|
||||
RealFileUtils.rm_rf(here('subdir')) if RealFile.exists?(here('subdir'))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user