Sanitize the output of a dummy component class
After commit 52ec5094f, we started to get a warning when running out
test suite:
```
WARNING: The #<Class:0x00007958c06fb8e0> component rendered HTML-unsafe
output. The output will be automatically escaped, but you may want to
investigate.
```
The reason is that, for security reasons, since version 3.9.0,
ViewComponent no longer renders unsafe output in the `call` method, so
we need to make sure the rendered text is safe. This is similar to what
Rails automatically does in views with `<%= %>`.
While this change doesn't affect the application (this class is only
used in a test), with it we avoid the warning.
This commit is contained in:
@@ -6,7 +6,7 @@ describe ApplicationComponent do
|
||||
|
||||
component_class = Class.new(ApplicationComponent) do
|
||||
def call
|
||||
t("shared.yes")
|
||||
sanitize(t("shared.yes"))
|
||||
end
|
||||
|
||||
def self.name
|
||||
|
||||
Reference in New Issue
Block a user