[rspec-devel] [ rspec-Bugs-7743 ] specing private class methods messes with their scope

noreply at rubyforge.org noreply at rubyforge.org
Thu Jan 11 00:02:55 EST 2007


Bugs item #7743, was opened at 2007-01-11 04:09
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=7743&group_id=797

Category: mock module
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 3
Submitted By: Chris Anderson (jchris)
>Assigned to: David Chelimsky (dchelimsky)
Summary: specing private class methods messes with their scope

Initial Comment:
When a class is speced as 'should_receive' a for a private method, later calls to a public class method which then calls the private method are treated as though they came from outside the class (eg: the private method called error is raised). If you then call the same public class method in a later context, you get an undefined method error when it calls the private method.

specs attached.

Thanks! This looks like a tough one...

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-01-11 05:02

Message:
Mocking private methods (instance or class) is not supported by RSpec.

I'll make this clear in the docs for the next release.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=7743&group_id=797


More information about the rspec-devel mailing list