RailsEventStore / ecommerce

Application with CQRS and Event Sourcing built on Rails and Rails Event Store
MIT License
424 stars 71 forks source link

Refactor client cart views to consistently use arbre #179

Open andrzejkrzywda opened 2 years ago

andrzejkrzywda commented 2 years ago

As a shortcut we now use erb views, which is inconsistent with other client views.

wasifhossain commented 2 years ago

if you have no plans to introduce any JS framework, then what about https://viewcomponent.org/#testing as an alternative to Arbre

andrzejkrzywda commented 2 years ago

Hey @wasifhossain, that's a very good question.

I haven't used ViewComponent much yet - do they allow to write the view templates fully in Ruby? If so, then yes, that could be a good alternative to consider here.

What I like about ViewComponent in this project is that it's more popular. More contributors would be familiar with this.

However, the goal is to have everything testable and "mutation-coverable". While I see that it's easy to test view components, I'm not sure how we can employ mutant here. The template code is not possible to mutation-cover, to my knowledge.

This may lead to a situation where we can write tests for views, but we don't know if we wrote enough of them. Which can lead to regressions during refactorings etc.

Maybe there's a solution, to somehow combine a tool like Arbre or Phlex (templates in Ruby) with the ViewComponents approach, but I'm not sure what would be the benefit of adding VC to our puzzles here in that case.

To be clear - right now, we're still not mutation testing the views, but we're close to this.

Any thoughts?