lundi 22 février 2016

How can globally I mock/replace components in integration tests?

I have a component "nested" which makes a web request, and I'm using this component from another component "parent".

I'm trying to write some integration tests for "parent", but they are failing as the "nested" component's web requests are failing.

Instead of mocking out the requests, I was just hoping to mock some of the "nested" functionality to prevent the web request. This is easily achievable with reopen, but of course this will cause the tests for "nested" to fail.

Does anyone know if there is a way that I can either stub pieces of "nested", or maybe use the registry to replace "nested" with an extended class?




Aucun commentaire:

Enregistrer un commentaire