Use block parameter rather than `$1` during `gsub!` so `ActiveSupport::SafeBuffer` values aren't mangled.

Fixes #15064
Require active_support/core_ext/string/output_safety and use html_safe rather than use non-public SafeBuffer API.
Update and add tests in array_ext_test.rb

- Fix `test_to_with_instruct` typo to `test_to_xml_with_instruct`

- Rename `test_to_xml` to `test_to_xml_with_hash_elements` to make test
name more specific.

- Add `test_to_xml_with_non_hash_elements` and
`test_to_xml_with_non_hash_different_type_elements`

  `to_xml` behaves different when containing elements are same and
  different types.

- Add `test_to_xml_with_indent_set`
Update require in `array_ext_test.rb`

Removed `FIMXE` tag to require necessary file but not the whole core_ext
flip conditional to use if/else instead of unless/else

Use if/else instead of unless/else so conditional reads better.
Merge pull request #15080 from eileencodes/flip-unless-else-conditional-in-halting-method

flip conditional to use if/else instead of unless/else
This model is a model so it should behaves like one
This is also a model
Test with ruby-head to make @tenderlove happy
Ok. Enough models for today :rage:
avoid array allocation when extracting usernames and passwords
fix bad merge
Fix regression on `assert_redirected_to`.

`assert_redirected_to` would fail if there is no controller set on
a `ActionDispatch::IntegrationTest`, as _compute_redirect_to_location
would be called on the controller to build the url.

This regression was introduced after 1dacfbabf3bb1e0a9057dd2a016b1804e7fa38c0.

[fixes #14691]
A minor stylistic fix and cleanup of mail deliveries.
Merge pull request #15085 from zuhao/refactor_actionmailer_log_subscriber_test

A minor stylistic fix and cleanup of mail deliveries.
Remove unnecessary setup and teardown.
docs, explain usage of `count` + `select`. Closes #15065. [ci skip]
Merge pull request #15086 from zuhao/refactor_actionmailer_mail_layout_test

Do not clear deliveries in setup.
Move state restoration from setup/teardown into affected test cases.
Merge pull request #15082 from zuhao/refactor_actionmailer_delivery_methods_test

Clean up deliveries after each test.