diff --git a/lib/fakefs/file_system.rb b/lib/fakefs/file_system.rb index 2ab9b1f..402b584 100644 --- a/lib/fakefs/file_system.rb +++ b/lib/fakefs/file_system.rb @@ -121,7 +121,10 @@ module FakeFS directories_under(dir) end else - dir.reject {|k,v| /\A#{pattern.gsub('?','.').gsub('*', '.*')}\Z/ !~ k }.values + pattern = pattern.gsub('?','.').gsub('*', '.*') + pattern = pattern.gsub(%r{\{([^\}]+)\}}) { |all| "(#{$1.gsub(',', '|')})" } + + dir.reject {|k,v| /\A#{pattern}\Z/ !~ k }.values end if parts.empty? # we're done recursing diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index aee0bf1..c6028df 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -569,6 +569,8 @@ class FakeFSTest < Test::Unit::TestCase assert_equal ['/path/bar/baz'], Dir['/path/bar/**/*'] + assert_equal ['/path/bar', '/path/foo'], Dir['/path/{foo,bar}'].sort + FileUtils.cp_r '/path', '/otherpath' assert_equal %w( /otherpath/foo /otherpath/foobar /path/foo /path/foobar ), Dir['/*/foo*']