I am trying to do a rspec feature test to test interactions on a react component. In the component, it imports and uses a third party service. This causes the issue that the react component pings directly to the real service when testing.
The third party service is used in both react and rails and I’ve written mocked service on both sides and done unit tests on both. But the service is directly imported in the react component and I don’t know how to replace it by the mocked service when test using capybara with rspec.