Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add fixture_paths configuration setting #2673
Add fixture_paths configuration setting #2673
Changes from 2 commits
f1afa0c
b64a9a4
7c5b35e
9d32316
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that
respond_to?(:file_fixture_path)
isfalse
in Rails 7.1+?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. This module is included in
TestCase
: https://github.com/rails/rails/blob/b72b7c35dd9506b08ed040594bbd4536139e6d3f/activesupport/lib/active_support/testing/file_fixtures.rb#L16But it could be set to
nil
explicitly if somebody decides to doRspec.configure { |config| config.file_fixture_path = nil }
orself.file_fixture_path = nil
in a test case. But in that case, I'm not sure why the wrapper should return a default value. Maybe I'm missing something here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Rails not support multiple paths here? Seems odd they would allow multiple paths for fixtures but not for files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is weird indeed, but I could not find any reference to a plural method in their codebase. Here the author of the change mentions that it is something that they might wanna do in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Rails solely configure this with file_fixture_path directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so: https://github.com/search?q=repo%3Arails%2Frails%20file_fixture_path&type=code
It defaults to
"#{Rails.root}/test/fixtures/files"
most of the time and you can overwrite that config. Rails does not use any of the configuredfixture_paths
to build thefile_fixture_path
. Althought the first of the fixture paths is"#{Rails.root}/test/fixtures"
by default, I think that relation is not enforced.