Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation around fixture paths #48512

Merged
merged 4 commits into from
Jun 20, 2023
Merged

Update documentation around fixture paths #48512

merged 4 commits into from
Jun 20, 2023

Conversation

zzak
Copy link
Member

@zzak zzak commented Jun 18, 2023

This PR makes a couple of changes, so I've broken them down atomically.

Based on what I've found from #47675, there were a couple of improvements to be made.

Please feel free to review them on a per-commit basis, starting:

Planning to not merge this one without feedback, since it's changing the public visibility of a method and adding other possibly controversial docs.

Copy link
Contributor

@adrianna-chang-shopify adrianna-chang-shopify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doc changes all look good to me! ❤️

I noticed while reviewing that the deprecation messages around the existing fixture_path methods could use adjusting (e.g. we should use TestFixtures.fixture_path is deprecated instead of TestFixtures#fixture_path is deprecated for the class method, the setter message refers to the getter method, etc...), so I'll open a small PR to tweak those.

zzak added 4 commits June 20, 2023 15:44
Since this method has been documented in the guides for ages, it's probably safe.

https://guides.rubyonrails.org/testing.html#revenge-of-the-fixtures

TODO: I don't like how these methods are documented on
ActionMailer::TestCase::Behavior, even though the API is meant to be
exposed through ActionMailer::TestCase
This removes the deprecated .fixture_path and .fixture_path= methods
from public documentation, and creates a class method for the getter and
setters.

Interestingly because these methods were always `class_attribute` based,
which RDoc doesn't parse, they weren't technically "public"
documentation.
These methods are only available when requiring the railties
"rails/test_help" file, which is included by default in the
test_helper.rb for newly generated Rails applications.

Since requiring that file is the only way, and some applications may
have removed it or not used test-unit when generating their application,
I think it's worth calling out explicitly here.
* Improve the spacing of various paragraphs
* Link to AS::TestCase.fixture_paths= API
* Add a note about needing to require "rails/test_help" to get fixture_paths
* Expanded briefly on YAML default map unordering property
* Improve heading weight consistency
* Unlink several RDoc autolinked things
@zzak zzak merged commit c25cc2e into rails:main Jun 20, 2023
8 of 9 checks passed
@zzak zzak deleted the fixtures-docs branch June 20, 2023 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants