aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorRolf Timmermans <r.timmermans@voormedia.com>2011-03-28 15:09:29 +0800
committerJosé Valim <jose.valim@gmail.com>2011-03-28 15:58:28 +0800
commit0a28073acc8e81e75a71be7098a4753325ce64f0 (patch)
treeade02b911c22226e2940209dce07ece13ab29d14 /railties/test
parent245542ea2994961731be105db6c076256a22a7a9 (diff)
downloadrails-0a28073acc8e81e75a71be7098a4753325ce64f0.tar.gz
rails-0a28073acc8e81e75a71be7098a4753325ce64f0.tar.bz2
rails-0a28073acc8e81e75a71be7098a4753325ce64f0.zip
Engines that use isolate_namespace with nested modules should set correct module prefix for their routes.
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/railties/engine_test.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb
index 0ce00db3c4..20797a2b0c 100644
--- a/railties/test/railties/engine_test.rb
+++ b/railties/test/railties/engine_test.rb
@@ -559,6 +559,45 @@ module RailtiesTest
assert_match /name="post\[title\]"/, last_response.body
end
+ test "isolated engine should set correct route module prefix for nested namespace" do
+ @plugin.write "lib/bukkits.rb", <<-RUBY
+ module Bukkits
+ module Awesome
+ class Engine < ::Rails::Engine
+ isolate_namespace Bukkits::Awesome
+ end
+ end
+ end
+ RUBY
+
+ app_file "config/routes.rb", <<-RUBY
+ AppTemplate::Application.routes.draw do
+ mount Bukkits::Awesome::Engine => "/bukkits", :as => "bukkits"
+ end
+ RUBY
+
+ @plugin.write "config/routes.rb", <<-RUBY
+ Bukkits::Awesome::Engine.routes.draw do
+ match "/foo" => "foo#index"
+ end
+ RUBY
+
+ @plugin.write "app/controllers/bukkits/awesome/foo_controller.rb", <<-RUBY
+ class Bukkits::Awesome::FooController < ActionController::Base
+ def index
+ render :text => "ok"
+ end
+ end
+ RUBY
+
+ add_to_config("config.action_dispatch.show_exceptions = false")
+
+ boot_rails
+
+ get("/bukkits/foo")
+ assert_equal "ok", last_response.body
+ end
+
test "loading seed data" do
@plugin.write "db/seeds.rb", <<-RUBY
Bukkits::Engine.config.bukkits_seeds_loaded = true