In this example I use rr gem, and stub an object method which is obj.project here, and assign returned value to any variable(in this case that is project_data ) when the method is called from any other method or class.
obj = Object.new
project_data = nil
stub(obj).project { |*x| project_data = x }
When I called any method that invokes project method with obj, project_data will be assigned by returned value of obj.project method. Is there any way to implement this technique with mocha gem? I googled the possible solutions but I couldn't figure out any solution