cypress-rails icon indicating copy to clipboard operation
cypress-rails copied to clipboard

Options for mocking 3rd party services to avoid network calls (from the Rails code) ?

Open galori opened this issue 1 year ago • 0 comments

I saw the other issue asking about getting VCR working, and it's likely requirement for running Puma single threaded.

What are the other options in this context? Possibilities:

  1. "test mode" in each client library
  2. WebMock?
  3. Using RSpec mocks?
  4. Use standalone service HTTP server or proxy to respond with fake responses
  5. Any other options? What is everyone else doing?

Option 1: Doesn't work for my use case (we integrate with hundreds of 3rd party libraries). Option 2: Could WebMock work? Would it need to be run in single thread mode like VCR? Option 3: Could be interesting but also clunky. Might require RSpec to launch Cypress from within examples, similar to how Capybara works Option 4: Any recommendation? I found http-mock-server but it has been archived. mock-server seems neat and feature complete but requires java (would like to avoid introducing new tech) and also seems fairly "heavy".

galori avatar Feb 09 '24 17:02 galori