button_to is not a button!
While working with Matheus we were trying to expect some text (the text on a button) to be on a page in a spec.
The self-reminder is that a rails button_to
is not a button
tag but it creates
form
tag with an input
with value
of the “button’s text” we have in the UI.
Ah, there will also
be a hidden input for the id
, to pass with the form for submission to the
controller action.
Post update: 1) Thanks to Sean soon we won’t have to remember this! commit to Rails 7
2) For the record, even in the way it is implemented today, we can pass a block to button_to
and render a button
tag.