-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Global mock support #143
Global mock support #143
Conversation
Codecov Report
@@ Coverage Diff @@
## master #143 +/- ##
==========================================
+ Coverage 98.3% 98.32% +0.02%
==========================================
Files 21 21
Lines 412 418 +6
==========================================
+ Hits 405 411 +6
Misses 7 7
Continue to review full report at Codecov.
|
lib/tesla/mock.ex
Outdated
@doc """ | ||
Setup global mocks. | ||
|
||
**WARNING**: This mock will be available to ALL process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: processes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
lib/tesla/mock.ex
Outdated
|
||
While this style is recommended, there is one drawback: | ||
if Tesla client is called from different process then the | ||
test case it will not get proper mock. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest a minor rewording to:
If Tesla client is called from a different process then the test case will not be mocked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case process itself will be mocked. Either way, both messages would be wrong ;)
It should be something like this "if Tesla client is called from different process it will not use the setup mock"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good :-)
Continuation of #136, also related to #140
I've moved setting up global mock into separate function to be explicit about it. It will also fail fast when used inappropriately with async test cases.
@zorbash, @amatalai please take a look.
@gottfrois, @pawelduda, @Daniel-Xu please try using tesla from
global-mock
branch and let us know if there are any issues.