Ensure application rake tasks and generators are loaded after the ones specified in railties/engines/rails. [#4471 state:resolved]
This commit is contained in:
parent
c9132c149c
commit
e461e1bc0e
@ -112,15 +112,15 @@ def initialize!
|
||||
|
||||
def load_tasks
|
||||
initialize_tasks
|
||||
super
|
||||
railties.all { |r| r.load_tasks }
|
||||
super
|
||||
self
|
||||
end
|
||||
|
||||
def load_generators
|
||||
initialize_generators
|
||||
super
|
||||
railties.all { |r| r.load_generators }
|
||||
super
|
||||
self
|
||||
end
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
require 'rake/rdoctask'
|
||||
|
||||
namespace :doc do
|
||||
def gem_path(gem_name)
|
||||
path = $LOAD_PATH.grep(/#{gem_name}[\w.-]*\/lib$/).first
|
||||
|
@ -1,3 +1,5 @@
|
||||
require 'rake/testtask'
|
||||
|
||||
TEST_CHANGES_SINCE = Time.now - 600
|
||||
|
||||
# Look up tests for recently modified sources.
|
||||
|
23
railties/test/application/rake_test.rb
Normal file
23
railties/test/application/rake_test.rb
Normal file
@ -0,0 +1,23 @@
|
||||
require "isolation/abstract_unit"
|
||||
|
||||
module ApplicationTests
|
||||
class RakeTest < Test::Unit::TestCase
|
||||
include ActiveSupport::Testing::Isolation
|
||||
|
||||
def setup
|
||||
build_app
|
||||
boot_rails
|
||||
FileUtils.rm_rf("#{app_path}/config/environments")
|
||||
end
|
||||
|
||||
def test_gems_tasks_are_loaded_first_than_application_ones
|
||||
app_file "lib/tasks/app.rake", <<-RUBY
|
||||
$task_loaded = Rake::Task.task_defined?("db:create:all")
|
||||
RUBY
|
||||
|
||||
require "#{app_path}/config/environment"
|
||||
::Rails.application.load_tasks
|
||||
assert $task_loaded
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user