mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Load Rails tasks for each new Rake::Application
Follow-up to #40143. Rails Rake tasks are loaded for each new `Rake::Application` instance via `Rails.application.load_tasks`. However, under the hood, `Rails.application.load_tasks` used `require` instead of `load`, which caused Rails tasks to be loaded for only the first `Rake::Application` instance. This commit changes the relevant `require` to `load`. Fixes #40184.
This commit is contained in:
parent
722ca6ba35
commit
be5eeb1a06
2 changed files with 13 additions and 1 deletions
|
@ -514,7 +514,7 @@ module Rails
|
|||
def run_tasks_blocks(app) #:nodoc:
|
||||
railties.each { |r| r.run_tasks_blocks(app) }
|
||||
super
|
||||
require "rails/tasks"
|
||||
load "rails/tasks.rb"
|
||||
task :environment do
|
||||
ActiveSupport.on_load(:before_initialize) { config.eager_load = config.rake_eager_load }
|
||||
|
||||
|
|
|
@ -29,6 +29,18 @@ module ApplicationTests
|
|||
assert_equal ["Rails version"], rails("about").scan(/^Rails version/)
|
||||
end
|
||||
|
||||
test "tasks can invoke framework tasks via Rails::Command.invoke" do
|
||||
add_to_config <<~RUBY
|
||||
rake_tasks do
|
||||
task :invoke_about do
|
||||
Rails::Command.invoke :about
|
||||
end
|
||||
end
|
||||
RUBY
|
||||
|
||||
assert_match(/^Rails version/, rails("invoke_about"))
|
||||
end
|
||||
|
||||
test "task backtrace is silenced" do
|
||||
add_to_config <<-RUBY
|
||||
rake_tasks do
|
||||
|
|
Loading…
Reference in a new issue