-
-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Labels
Description
Hello, there.
Thanks for writing and maintaining this lib. This is some awesome work.
I'm currently trying to integrate it with my Rails app, and I've found a situation that I don't know how to work around.
My Rails app has to call some 3rd party services using standard HTTP requests. In our tests that run in rspec we can just stub those requests and provide the response body we want. But since with Cypress I'm running my application in an environment that is not rspec, is there a way to stub outgoing requests from the Rails server?
This is an example where an outgoing request is being stubbed for regular tests:
shared_context 'when using ViaCEP' do
before do
stub_request(:get, %r{https://viacep.com.br/ws/.*/json})
.with(headers: { 'Host' => 'viacep.com.br' })
.to_return(status: 200, body: viacep_response.to_json)
end
let(:viacep_response) { build(:viacep_address) }
end
Regards.