Skip to content

Stop using UrlHelper includes in specs

Katrin Leinweber requested to merge epic-6767-f-refactor-IncludeUrlHelpers into master

What does this MR do and why?

Closes #341401 (closed)

And thus completes the work on &6767 (closed)


The following, yq-based script can reproduce the changes:

todos='.rubocop_todo/rails/include_url_helper.yml'
files=$(yq '."Rails/IncludeUrlHelper".Exclude.[]' < $todos)

for file in $files; do

  # Remove todo
  sd "\- $file" '' $todos

  # Remove include & correct resulting violation
  sd 'include ActionView::Helpers::UrlHelper' '' "$file"
  bundle exec rubocop --auto-correct "$file"

  # Update known helper method calls
  sd ' link_to' ' ActionController::Base.helpers.link_to' "$file"
  sd ' mail_to' ' ActionController::Base.helpers.mail_to' "$file"
  bundle exec rspec "$file"
done

rm $todos

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Katrin Leinweber

Merge request reports