Describe the bug
Hey there 👋 It's me again! Just popping in to describe some unexpected behavior around param coercion. My pair and I noticed today that visiting a Lookbook preview in a system test does not result in properly coerced parameters. We're visiting like this:
visit "/page?my_param=foo"
In the preview code, the #preview_name method has an @param annotation for the my_param parameter that indicates it should be coerced to a symbol. Unfortunately, the coercion does not occur:
# @param [Symbol] select [foo, bar]
def preview_name(my_param: :foo)
# my_param is a string here
...
end
To Reproduce
Steps to reproduce the behavior:
- Create a preview as described above.
- Render that preview in a Rails system test.
- Observe that parameters are not coerced.
Expected behavior
I expect the my_param parameter to be of type Symbol instead of String.
Version numbers
Please complete the following information:
- Lookbook: 2.3.2
- ViewComponent: 3.13.0
- Rails: 7.1.3
- Ruby: 3.3.3
Describe the bug
Hey there 👋 It's me again! Just popping in to describe some unexpected behavior around param coercion. My pair and I noticed today that visiting a Lookbook preview in a system test does not result in properly coerced parameters. We're visiting like this:
In the preview code, the
#preview_namemethod has an@paramannotation for themy_paramparameter that indicates it should be coerced to a symbol. Unfortunately, the coercion does not occur:To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect the
my_paramparameter to be of typeSymbolinstead ofString.Version numbers
Please complete the following information: