You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if I want to add an integration test which ensures "the structure of response of the external service doesn't change":
test"the structure of the response of external service doesn't change"doassert{:ok,%{status: 200,body: %{"celsius"=>_}}}=MyApp.Weather.get_temperature("Krakow, Poland")# it will report:# (RuntimeError) cannot find mock/stub MyApp.Weather in process #PID<0.519.0>end
Above test won't work, because we have set a global :plug option in test environment, and there's no way to opt out.
Is there any way to write such type of tests?
The text was updated successfully, but these errors were encountered:
In short
Req.Test
is good for unit tests without requesting external services.But, when writing tests which have to request external service, it seems that there's no way to do that.
In detail
In order to describe this issue in more detail, I'd like to use the example provided by the doc of
Req.Test
.First, we use following line to make sure the request against a plug stub named
MyApp.Weather
:Then, we write a test without requesting external service like this:
So far so good.
But if I want to add an integration test which ensures "the structure of response of the external service doesn't change":
Above test won't work, because we have set a global
:plug
option in test environment, and there's no way to opt out.Is there any way to write such type of tests?
The text was updated successfully, but these errors were encountered: