Commit Graph

7 Commits

Author SHA1 Message Date
Javi Martín
32b1fc53e1 Add and appy MultilineOperationIndentation rule
This way it's easier to see when lines are part of multiline
statements and when they belong to `if` statements.
2023-08-18 14:56:16 +02:00
taitus
934ce21871 Allow passing :with argument to :be_rendered
We need it in order to check the rendered content.
2021-11-04 10:49:36 +01:00
taitus
612872ac7a Define and apply matcher :be_rendered
Add this changes to make components specs clear
2021-11-04 10:49:36 +01:00
taitus
2b35144540 Unify expectations on spec components folder
In this PR (https://github.com/consul/consul/pull/4683) a new syntax was introduced
in the component specs to check that the component was not rendering.
It seems interesting to add this syntax to the rest of the cases and thus unify the way
we check that a component is not rendering.
2021-11-04 10:49:36 +01:00
Javi Martín
4cbf945228 Infer type for component specs automatically 2021-09-08 12:39:36 +02:00
Javi Martín
7abca09e03 Extract methods in link list component
Since we're simplifying the main method, we can use a view file instead
of the `call` method. This way we make the code more consistent with the
rest of our components, since we always use a separate file.

Doing so generates an extra newline at the end of the generated HTML, so
we need to change a couple of tests a little bit.
2021-07-05 22:27:39 +02:00
Javi Martín
d0243764a2 Extract component to render a list of links
This way it's easier to refactor it and/or change it.

Back in commit c156621a4 I wrote:

> Generally speaking, I'm not a big fan of helpers, but there are
> methods which IMHO qualify as helpers when (...) many Rails helpers,
> like `tag`, follow these principles.

It's time to modify these criteria a little bit. In some situations,
it's great to have a helper method so it can be easily used in view
(like `link_to`). However, from the maintenance point of view, helper
methods are usually messy because extracting methods requires making
sure there isn't another helper method with that name.

So we can use the best part of these worlds and provide a helper so it
can be easily called from the view, but internally make that helper
render a component and enjoy the advantages associated with using an
isolated Ruby class.
2021-07-05 22:27:39 +02:00