I have some code like this:
new_method = lambda do
puts "Hey, I'm the new method!"
redirect_to login_path
end
MyController.any_instance.stubs(:my_method).returns(new_method)
The problem is it's returning the lambda, instead of calling it...
So how do I stub controller methods? Or to put it differently, how do I stub a method and return a block to be run?