Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using hierarchy with flow #19

Closed
agramms opened this issue May 1, 2020 · 2 comments
Closed

Using hierarchy with flow #19

agramms opened this issue May 1, 2020 · 2 comments
Labels
wontfix This will not be worked on

Comments

@agramms
Copy link
Contributor

agramms commented May 1, 2020

When I use a class that inherit from a class that use Micro::Case with a flow defined, this class have a different behavior from expected.

First, i have to define the same flow that is defined in top level class, the flow was not called if it isn't declared in leaf class.

Top Level Class:

Pasted_Image_01_05_20_11_01

Leaf one:

Pasted_Image_01_05_20_10_50

But even with that, in the tests it some times call the leaf call! class, and others from the inherited class. I'm using rspec for the tests.

If I call only one test, the result is ok:

image

but when I run all the tests, the Success response is from the inherited calls, not from the other one:

image

I think that it can be a unexpected way of using flow.
I'm using flow in the right way?

Let me know if you need any additional information.

Thanks!

@serradura
Copy link
Owner

Hi @agramms, thank you for reporting this issue.

As you said, I think that is a bug. I'll fix it and ensure that the usage of inheritance of classes which has an inner flow works as expected. But, I would like to recommend the usage of composition over inheritance, in this case, you could duplicate the flow declaration in both classes, or create a common flow to be the first step of these classes to avoid inheritance.

@serradura serradura added the wontfix This will not be worked on label May 2, 2020
@serradura
Copy link
Owner

Hi @agramms, I thought about your issue and the root cause of it hurts one of the goals of this project. (Solve complex business logic, by allowing the composition of use cases.).

So, because of this, I won't fix it. But, I'll add a new feature that will raise an exception if somebody tries to inherit from a use case that has an inner flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants