How do I mock a response of a controller that redirects to an external API?
问题 My orders_controller needs to forward an order to a payment gateway. It's making my tests fail: No route matches [GET] "/v2/checkout/payment.html" That's is the URL that the PaymentGateway object redirects to. How can I trick my tests into thinking that the payment gateway returned a response? In reality, it doesn't. It may or may not return the user depending on his choice. It's similar to paying with Paypal. def create @order = current_user.orders.build(params[:order]) @order.add_line_items