From 74598fe7e9097484c4029e2731e462c6c82836f9 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sat, 25 Sep 2010 19:02:14 +0200 Subject: Do not overwrite _railtie method on namespace while creating isolated engine or application. In order to run Engine as standalone application, you will need Rails::Application instance in the same namespace that engine one. It's very important to leave _railtie bound to whatever used "namespace" method first. --- railties/test/railties/engine_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'railties/test') diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb index a9dd7d4c1b..17bffe05e1 100644 --- a/railties/test/railties/engine_test.rb +++ b/railties/test/railties/engine_test.rb @@ -643,5 +643,25 @@ module RailtiesTest Bukkits::Engine.load_seed assert Bukkits::Engine.config.bukkits_seeds_loaded end + + test "using namespace more than once on one module should not overwrite _railtie method" do + @plugin.write "lib/bukkits.rb", <<-RUBY + module AppTemplate + class Engine < ::Rails::Engine + namespace(AppTemplate) + end + end + RUBY + + add_to_config "namespace AppTemplate" + + app_file "config/routes.rb", <<-RUBY + AppTemplate::Application.routes.draw do end + RUBY + + boot_rails + + assert_equal AppTemplate._railtie, AppTemplate::Engine + end end end -- cgit v1.2.3