[Spike] Use meta programming to make testing ROP classes simpler
MR: Use meta programming to make testing remote dev... (!152657 - closed)
Description
In the Remote-Development codebase we implement a Railway-Oriented-Programming style where we expose only one singleton public method for services to call.
This exposed public method relies on domain classes who also expose only one singleton public method and are applied in a chaining manner, see this code block .
As a result of this, we concluded that we could make the test suite surrounding ROP easier to understand and leaner by automatically inferring what method to call when mocking chain classes (as there should be only one). This also brought about the idea of having a rubocop rule that would warn against breaking the "one singleton public method" convention discussed here in the concerning classes.
Context
The following discussion on this MR: !151574 (comment 1889597066)+ explains what needs to implemented.
In summary we need to:
-
Implement helper methods to determine what ROP chain class method to call in tests -
Refactor tests to use the new approach -
Implement/Use an existing a rubocop rule that enforces the "one singleton public method" convention -
Attempt to have a remote-development rubocop config file to control rules we apply on our files without bloating the base rubocop file with our rules.