I’d like to know how to debug callers with message expectations. I
have a message expectation that should be called only once but for
some reason is called 13 times and I’d like to know where it’s called
from. I’ve made the expectation return the value with a block and made
it print the call stack but it only prints one stack, not 13 stacks as
I would have thought. Why is that?
The relevant code is here: controller_file.rb · GitHub.
I am using rails 3.0.1 and rspec 2.0.1.
On Sun, Nov 14, 2010 at 11:55 PM, Toni T. [email protected] wrote:
I’d like to know how to debug callers with message expectations. I
have a message expectation that should be called only once but for
some reason is called 13 times and I’d like to know where it’s called
from. I’ve made the expectation return the value with a block and made
it print the call stack but it only prints one stack, not 13 stacks as
I would have thought. Why is that?
The relevant code is here: controller_file.rb · GitHub.
I am using rails 3.0.1 and rspec 2.0.1.
For what you’re doing it would be far simpler to say it this way:
Course.stub(:find) { puts caller.join(“\n”); course }
That, or what you have, should expose the caller, so the problem is
probably that something else is different in the spec than it is when
you run the app. Could be the stuff you’re stubbing like the
stub_chain in the before block or the fact that you’re using a
mock_model for Signup.
HTH,
David