Ruby on Rails Method Mocks in the Controller
问题 I'm trying to mock a method call to an outside API inside one of my rails controllers (in this case, Instagram.get_access_token) and I'm having some trouble. As written, the code is still calling the real Instagram.get_access_token method. How do I have the controller use my simple mock instead? sessions_controller.rb: class SessionsController < ApplicationController require 'instagram' include ApplicationHelper def auth_callback response = Instagram.get_access_token(params[:code], redirect