Let's say I have a method that references an instance variable directly:
class MyClass
def method1
puts @instance_var
end
end
How can I stub out the value of @instance_var
using mocha
in a Test::Unit
test?
Let's say I have a method that references an instance variable directly:
class MyClass
def method1
puts @instance_var
end
end
How can I stub out the value of @instance_var
using mocha
in a Test::Unit
test?
You can't. That's one of the many reasons why you should never access ivars directly.