I would like to have an ability of testing a remote 3d party API for endpoint responses, which is why I would like to write a bunch of local rspec tests and launch them periodically, to see if these endpoints are working as expected with no breaking changes. Since my application is highly dependent on this constantly changing API, I have little choice left but to automate my test.
At the moment I took a regular rspec API test code:
require "rails_helper" RSpec.describe "Remote request", type: :request do describe ".send request" do it ".posts valid data" do post "http://123.45.67.89/api/endpoint", params: { "job_request_id": 123456, "data": "12345", "app_secret": "12345", "options": { ... } } expect(JSON.parse response.body).to include("message" => "success") expect(response).to have_http_status(200) end end end The problem with this code is that Rspec is hitting the /api/endpoint url, instead of the full http://123.45.67.89/api/endpoint url. How can I change this behaviour?