This method redirects to an external website. How do I test this behaviour? I know that the method works correctly because I tested in the browser, but I can't get the test to pass.
def create
if @order.save
redirect_to Gateway.new(@order).send
else
render 'new'
end
end
I wrote this test which fails with "Missing Template error":
describe 'User creates an order with valid info' do
before do
WebMock.allow_net_connect!
stub_request(:any, "https://external-site.com/v2/checkout")
end
it 'creates the order and redirects to checkout page' do
fill_in_order
expect { click_button "Submit" }.to change(Order, :count)
end
end
Error:
Failure/Error: click_button "Submit"
ActionView::MissingTemplate:
Missing template orders/create, ...