Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ensure application rake tasks and generators are loaded after the one…

…s specified in railties/engines/rails. [#4471 state:resolved]
  • Loading branch information...
commit e461e1bc0ec0a5c365840031309b83143e12955a 1 parent c9132c1
@josevalim josevalim authored
View
4 railties/lib/rails/application.rb
@@ -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
View
2  railties/lib/rails/tasks/documentation.rake
@@ -1,3 +1,5 @@
+require 'rake/rdoctask'
+
namespace :doc do
def gem_path(gem_name)
path = $LOAD_PATH.grep(/#{gem_name}[\w.-]*\/lib$/).first
View
2  railties/lib/rails/test_unit/testing.rake
@@ -1,3 +1,5 @@
+require 'rake/testtask'
+
TEST_CHANGES_SINCE = Time.now - 600
# Look up tests for recently modified sources.
View
23 railties/test/application/rake_test.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.