diff --git a/lib/fakefs/file_system.rb b/lib/fakefs/file_system.rb index 2ab9b1f..f09f74c 100644 --- a/lib/fakefs/file_system.rb +++ b/lib/fakefs/file_system.rb @@ -121,7 +121,8 @@ module FakeFS directories_under(dir) end else - dir.reject {|k,v| /\A#{pattern.gsub('?','.').gsub('*', '.*')}\Z/ !~ k }.values + regexp_pattern = /\A#{pattern.gsub('?','.').gsub('*', '.*').gsub(/\{(.*?)\}/) { "(#{$1.split(',').join('|')})" }}\Z/ + dir.reject {|k,v| regexp_pattern !~ k }.values end if parts.empty? # we're done recursing diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb index 80b4252..b443512 100644 --- a/test/fakefs_test.rb +++ b/test/fakefs_test.rb @@ -573,6 +573,8 @@ class FakeFSTest < Test::Unit::TestCase FileUtils.cp_r '/path', '/otherpath' assert_equal %w( /otherpath/foo /otherpath/foobar /path/foo /path/foobar ), Dir['/*/foo*'] + + assert_equal ['/path/bar', '/path/foo'], Dir['/path/{foo,bar}'] end def test_dir_glob_handles_root