Skip to content

Instantly share code, notes, and snippets.

@jmhodges
Created June 1, 2009 11:33
Show Gist options
  • Save jmhodges/121358 to your computer and use it in GitHub Desktop.
Save jmhodges/121358 to your computer and use it in GitHub Desktop.
# fakefs will break autoloading in your tests. You can correct this by
# eval'ing the modules you care about before requiring fakefs. One way
# to do this would be to take the top-level module (or class) that
# contains modules (or classes) to be autoloaded and eval all of them
# in.
def autoload_all(namespace)
namespace.constants.each do |c|
const = namespace.module_eval c
autoload_all(const) if const.is_a? Module
end
end
autoload_all MyModuleOrClass
require 'fakefs'
# .. the rest of your test code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment