diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-09-13 22:57:48 -0700 |
---|---|---|
committer | Jesse Wolfe <jes5199@gmail.com> | 2010-09-13 22:57:48 -0700 |
commit | 754ed19a8105a1be01c723a91abf9999ec6a8ab3 (patch) | |
tree | 8a3b59432ff56fbaf64d1cb6448e4e228f5359c0 /spec/monkey_patches/publicize_methods.rb | |
parent | 21afb51a1b84116b2a906a6959ae588f45135104 (diff) | |
parent | efa834aaec596b0d5e7b314a53e6b258ce44728c (diff) | |
download | puppet-754ed19a8105a1be01c723a91abf9999ec6a8ab3.tar.gz puppet-754ed19a8105a1be01c723a91abf9999ec6a8ab3.tar.xz puppet-754ed19a8105a1be01c723a91abf9999ec6a8ab3.zip |
Merge commit '2.6.1rc4'
Diffstat (limited to 'spec/monkey_patches/publicize_methods.rb')
-rw-r--r-- | spec/monkey_patches/publicize_methods.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/monkey_patches/publicize_methods.rb b/spec/monkey_patches/publicize_methods.rb new file mode 100644 index 000000000..b39e9c002 --- /dev/null +++ b/spec/monkey_patches/publicize_methods.rb @@ -0,0 +1,11 @@ +# Some monkey-patching to allow us to test private methods. +class Class + def publicize_methods(*methods) + saved_private_instance_methods = methods.empty? ? self.private_instance_methods : methods + + self.class_eval { public(*saved_private_instance_methods) } + yield + self.class_eval { private(*saved_private_instance_methods) } + end +end + |