Created
June 1, 2009 11:33
-
-
Save jmhodges/121358 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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