Tests: Script loading global vars overrides registerAllowedMethod
Closed this issue · 3 comments
When the MPLModule or any other script loads - it can override the registerAllowedMethod
with included vars
steps Global Vars
. This behavior don't allow to mock the custom steps we don't need to test.
Proposed way to fix: override function registerAllowedMethod(MethodSignature methodSignature, Closure closure)
and check existence of such allowed method by isMethodAllowed
before adding the data to allowedMethodCallbacks
. This function is used by the internal helper setGlobalVars
and with changes will not allow to override already set mocks.
Also it will be possible to override the allowed methods manually using registerAllowedMethod(String name, List<Class> args = [], Closure closure)
helper method.
OMG, found issue.
Yep, now it's working.