#67 open
James Mead

expectations changing visibility of methods

Reported by James Mead | May 16th, 2010 @ 11:37 PM

On behalf of krist0ff (from GitHub issue http://github.com/floehopper/mocha/issues#issue/3)

if I have a private method on object, and I set an expectation on it:

object.expects(:private_method)

the visibility of this method is changed to public.
If I have any code, that is checking for visibility of methods, ie:

if private_methods.include?(:private_method)

then obviously mocha will change the behavior of this code.
temporarily, I work around it with

object.expects(:private_method)
object.class_eval "private :private_method" # fix for mocha issues

which works - that means that mocha doesn't need to make it public, right?

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A mocking & stubbing library for Ruby.

* <a href="http://github.com/floehopper/mocha">GitHub repository</a>
* <a href="http://mocha.rubyforge.org">Documentation</a>
* <a href="http://groups.google.com/group/mocha-developer">Mailing List</a>

People watching this ticket

Tags

Pages