Closed
Description
The following behavior seems not right, as the transformed expression ends up in error.
rubocop-rails/spec/rubocop/cop/rails/content_tag_spec.rb
Lines 78 to 87 in 7570fb6
Expected behavior
Leave a call with legacy arguments such as tag(:br, {class: ["strong", "highlight"]}, true, false)
as it as, or convert into something legal and non-deprecated (does it have any outside a raw HTML string?).
Actual behavior
It outputs tag.br({class: ["strong", "highlight"]}, true, false)
, which results in error.
Confirmed on my env:
$ rails c
Running via Spring preloader in process 29296
Loading development environment (Rails 6.1.4.1)
[1] pry(main)> helper.tag.br({class: ["strong", "highlight"]}, true, false)
ArgumentError: wrong number of arguments (given 4, expected 1..2)
from /home/user/.rbenv/versions/3.0.2/lib/ruby/gems/3.0.0/gems/actionview-6.1.4.1/lib/action_view/helpers/tag_helper.rb:56:in `tag_string'
[2] pry(main)> helper.tag(:br, {class: ["strong", "highlight"]}, true, false)
=> "<br class=\"strong highlight\">"
Steps to reproduce the problem
Run Rubocop.
RuboCop version
$ rubocop -V
1.21.0 (using Parser 3.0.2.0, rubocop-ast 1.11.0, running on ruby 3.0.2 x86_64-linux)
- rubocop-performance 1.11.5
- rubocop-rails 2.12.2
- rubocop-rspec 2.5.0
Activity