dry-rb / dry-transaction

Business transaction DSL
http://dry-rb.org/gems/dry-transaction
MIT License
469 stars 55 forks source link

Add test to improve coverage and showing current behaviour #95

Closed GustavoCaso closed 6 years ago

GustavoCaso commented 6 years ago

75

I decided to start working on this one.

I added some test that proves that injecting operations when no container will work as expected.

@timriley following your comments on the issue I think the test satisfy your expectation.

what if someone was using dry-transaction without any container at all? That person may want to define transactions consisting of steps using injected operation objects, and still have the ability to wrap those in local methods (or not).

So this won't allow an injected operation object to fully replace a matching instance method. That method always will always get called first.

As a change, this does help dry-transaction work better without a container (i.e. such transactions would require all their step operation objects to be manually injected), which I think is a flexibility win.

Maybe if people still complaining that they want a way to completely replace local methods with injected operations for testing cases we could provide a test interface that would actually replace it. Probably in other PR.