Skip to content

Instantly share code, notes, and snippets.

@pinglamb
Created January 27, 2015 02:32
Show Gist options
  • Select an option

  • Save pinglamb/b4d79be12675d486332b to your computer and use it in GitHub Desktop.

Select an option

Save pinglamb/b4d79be12675d486332b to your computer and use it in GitHub Desktop.
Rspec Constant Redefine Helper
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