I have a private method which returns something based on the caller method:
private
def aPrivateMethod
r = nil
caller_method = caller[0][/`([^']*)'/, 1]
case caller_method
when "method_1"
r = "I was called by method_1"
when "method_2"
r = "I was called by method_2"
end
return r
end
When writing the test unit the method name calling this private method will not be method_1 nor method_2, it will be something beginning with test and I cannot find a solution to return a pass from the test.
You can create a proxy method in your test class for this purpose
And then call this method from your test.