提交 19e7c524 编写于 作者: J José Valim

Ensure config/application.rb also uses app_const instead of app_name.classify.

上级 423e2acb
......@@ -193,8 +193,12 @@ def app_name
@app_name ||= File.basename(destination_root)
end
def app_const_base
@app_const_base ||= app_name.gsub(/\W/, '_').squeeze('_').classify
end
def app_const
@app_const ||= "#{app_name.gsub(/\W/, '_').squeeze('_').classify}::Application"
@app_const ||= "#{app_const_base}::Application"
end
def valid_app_const?
......
require File.expand_path('../boot', __FILE__)
module <%= app_name.classify %>
module <%= app_const_base %>
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
......
......@@ -61,7 +61,8 @@ def test_invalid_application_name_raises_an_error
def test_invalid_application_name_is_fixed
silence(:stdout){ Rails::Generators::AppGenerator.start [File.join(destination_root, "things-43")] }
assert_file "things-43/config/environment.rb", /Things43::Application/
assert_file "things-43/config/environment.rb", /Things43::Application\.initialize!/
assert_file "things-43/config/application.rb", /^module Things43$/
end
def test_config_database_is_added_by_default
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册