using Mocha
in simple code turned in unexpected way. Could you explain what is going wrong?
require 'test-unit'
require 'mocha'
class A
def m
caller.first
end
end
So using this simple class, we can get the latest caller:
A.new.m #=> "(irb):32:in `irb_binding'" (for example)
But if I want to stub caller
call, things going wrong.
a = A.new
a.stubs(:caller)
Mocha::ExpectationError: unexpected invocation: #<A:0x6aac20>.caller()
My guess is to check out Mocha
sources, but I will do it later ;)
- ruby 1.9.3p194
- test-unit 2.5.0, 2.4.8
- mocha 0.12.6