Closed venkata-reddy-dev closed 7 months ago
But why not simply setting allowReasignment== true? why a new property? what do I miss here?
OK, I now understood the goal. We should name it skipDoubleRegistration
and mark it visibleForTesting
Also please also add it to the readme
Okay I will do changes as requested
Thanks for the response
@escamoteur changes are done as you suggested.
@escamoteur can you review this changes and merge, if there is no code review comments.
This PR is the implementation for feature request #335
Use case :
Some times developer don't want to touch production code to write test cases.
Scenario :
Code was release to production but some test cases are not written due to some high priorities. if developer want to write test cases after some time, Then some test mock implementations need to put in place of real implementations.
To do this developer need to add if-else cases in production code to place right dependencies for test environments. I feel touching production code after release, just for writing extra test cases is not a good approach.
Currently get_it does not have a capability to skip registrations if already registered. it throws Argument Error
Here is the test case which throws Argument Error
This PR adds one boolean variable
skipDoubleRegistration
to get_it configuration to ignore registration silently.Here is the test case:
To understand more, i have implemented a real world use case in a sample git repo, look into source code
I am open to take feedback and happy to modify this PR to land this feature requirement into get_it package.