This adds a test interface that allows for injected operations to fully replace local defined operations and container base operations.
The idea behind this is that for testing porpuses is to be able to fully replace operations with injected ones, avoiding unwanted behavior in our tests.
My first idea was to add a class method to the transaction something like Transaction.enable_injection! but since the returning class after creating a transaction class is an anonymous class make it harder to add methods. I decided to use a wrapping module that injects this functionality by overwriting the resolve_operation method from the InstanceMethods module.
I think is a good start for improving the library and help user test their transaction classes.
75
This adds a test interface that allows for injected operations to fully replace
local defined operations
andcontainer base operations
.The idea behind this is that for testing porpuses is to be able to fully replace operations with injected ones, avoiding unwanted behavior in our tests.
My first idea was to add a class method to the transaction something like
Transaction.enable_injection!
but since the returning class after creating a transaction class is an anonymous class make it harder to add methods. I decided to use a wrapping module that injects this functionality by overwriting theresolve_operation
method from theInstanceMethods
module. I think is a good start for improving the library and help user test their transaction classes.@timriley WDYT?