Created
January 27, 2015 02:32
-
-
Save pinglamb/b4d79be12675d486332b to your computer and use it in GitHub Desktop.
Rspec Constant Redefine Helper
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
| module ConstantHelper | |
| def redefine_constant(namespace, const_name, new_value) | |
| namespace.send(:remove_const, const_name) if namespace.const_defined?(const_name) | |
| namespace.const_set(const_name, new_value) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment