diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-24 11:06:06 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-24 11:06:06 +0100 |
commit | e0bdc4f446686a498c3117e27ed8561f5c6d34f1 (patch) | |
tree | 3b702991c7abdcdf5827b02b70fdfd59f1573e97 /railties/test | |
parent | 5cd9aad4fdf55c591fe8e12657008e83315251d7 (diff) | |
download | rails-e0bdc4f446686a498c3117e27ed8561f5c6d34f1.tar.gz rails-e0bdc4f446686a498c3117e27ed8561f5c6d34f1.tar.bz2 rails-e0bdc4f446686a498c3117e27ed8561f5c6d34f1.zip |
Ensure namespaced controllers in engines work.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/plugins/vendored_test.rb | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/railties/test/plugins/vendored_test.rb b/railties/test/plugins/vendored_test.rb index 6207cd13c1..1fc8766def 100644 --- a/railties/test/plugins/vendored_test.rb +++ b/railties/test/plugins/vendored_test.rb @@ -17,6 +17,10 @@ module PluginsTest require "#{app_path}/config/environment" end + def app + @app ||= Rails.application + end + test "it loads the plugin's init.rb file" do boot_rails assert_equal "loaded", BUKKITS @@ -202,7 +206,6 @@ en: YAML boot_rails - require "#{app_path}/config/environment" assert_equal %W( #{RAILS_FRAMEWORK_ROOT}/activesupport/lib/active_support/locale/en.yml @@ -217,6 +220,33 @@ YAML assert_equal "2", I18n.t(:foo) assert_equal "1", I18n.t(:bar) end + + test "namespaced controllers with namespaced routes" do + @plugin.write "config/routes.rb", <<-RUBY + ActionController::Routing::Routes.draw do + namespace :admin do + match "index", :to => "admin/foo#index" + end + end + RUBY + + @plugin.write "app/controllers/admin/foo_controller.rb", <<-RUBY + class Admin::FooController < ApplicationController + def index + render :text => "Rendered from namespace" + end + end + RUBY + + boot_rails + + require 'rack/test' + extend Rack::Test::Methods + + get "/admin/index" + assert_equal 200, last_response.status + assert_equal "Rendered from namespace", last_response.body + end end class VendoredOrderingTest < Test::Unit::TestCase |