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
Automatically add test/fixtures
in engines to fixture_paths
#48287
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -615,6 +615,15 @@ def load_seed | |
end | ||
end | ||
|
||
initializer :add_fixture_paths do | ||
next if is_a?(Rails::Application) | ||
|
||
fixtures = config.root.join("test", "fixtures") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should get from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked into |
||
if fixtures.exist? && fixtures.to_s.start_with?(Rails.root.to_s) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this check for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, I found that if we don't do this, we include test fixtures from gem engines etc which I assumed we wouldn't want in typical usage. But I wasn't really sure, which is why I asked about this. |
||
ActiveSupport.on_load(:active_record_fixtures) { self.fixture_paths |= ["#{fixtures}/"] } | ||
end | ||
end | ||
|
||
initializer :prepend_helpers_path do |app| | ||
if !isolated? || (app == self) | ||
app.config.helpers_paths.unshift(*paths["app/helpers"].existent) | ||
|
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.
We probably should just use this same initializer to register the application's fixtures.