add spec for Dir.glob with special directory name and fix it

* See https://bugs.ruby-lang.org/issues/8258
  and https://github.com/rails/rails/issues/6010