Skip to content

Commit 6fc8b54

Browse files
committed
add missing require rake
In ff8035d, require rake is deferred. Therefore, it is necessary to require rake even `Engine::CommandsTasks.
1 parent 5cb6b88 commit 6fc8b54

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

railties/lib/rails/engine/commands_tasks.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def parse_command(command)
103103
end
104104

105105
def rake_tasks
106+
require_rake
107+
106108
return @rake_tasks if defined?(@rake_tasks)
107109

108110
load_generators
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
require "abstract_unit"
2+
3+
class Rails::Engine::CommandsTasksTest < ActiveSupport::TestCase
4+
def setup
5+
@destination_root = Dir.mktmpdir("bukkits")
6+
Dir.chdir(@destination_root) { `bundle exec rails plugin new bukkits --mountable` }
7+
end
8+
9+
def teardown
10+
FileUtils.rm_rf(@destination_root)
11+
end
12+
13+
def test_help_command_work_inside_engine
14+
output = capture(:stderr) do
15+
Dir.chdir(plugin_path) { `bin/rails --help` }
16+
end
17+
assert_no_match "NameError", output
18+
end
19+
20+
private
21+
def plugin_path
22+
"#{@destination_root}/bukkits"
23+
end
24+
end

0 commit comments

Comments
 (0)