aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application/routing_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-12-21 11:21:27 +0100
committerJosé Valim <jose.valim@gmail.com>2009-12-21 11:21:27 +0100
commit5f34421c77b4cd873baadbbca877a93de5a4d602 (patch)
tree8182bb1c53864ab06079e14116a61d66e9617f7d /railties/test/application/routing_test.rb
parentcf7b94c013d4e824433a018001474e71ddd81a99 (diff)
parentf09ad263cabe2e781c1994b85375fee8deba4317 (diff)
downloadrails-5f34421c77b4cd873baadbbca877a93de5a4d602.tar.gz
rails-5f34421c77b4cd873baadbbca877a93de5a4d602.tar.bz2
rails-5f34421c77b4cd873baadbbca877a93de5a4d602.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'railties/test/application/routing_test.rb')
-rw-r--r--railties/test/application/routing_test.rb70
1 files changed, 70 insertions, 0 deletions
diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb
index 1bfec3805b..decde056fd 100644
--- a/railties/test/application/routing_test.rb
+++ b/railties/test/application/routing_test.rb
@@ -81,5 +81,75 @@ module ApplicationTests
get '/admin/foo'
assert_equal 'admin::foo', last_response.body
end
+
+ test "merges with plugin routes" do
+ controller 'foo', <<-RUBY
+ class FooController < ActionController::Base
+ def index
+ render :text => "foo"
+ end
+ end
+ RUBY
+
+ app_file 'config/routes.rb', <<-RUBY
+ ActionController::Routing::Routes.draw do |map|
+ match 'foo', :to => 'foo#index'
+ end
+ RUBY
+
+ plugin 'bar', 'require File.dirname(__FILE__) + "/app/controllers/bar"' do |plugin|
+ plugin.write 'app/controllers/bar.rb', <<-RUBY
+ class BarController < ActionController::Base
+ def index
+ render :text => "bar"
+ end
+ end
+ RUBY
+
+ plugin.write 'config/routes.rb', <<-RUBY
+ ActionController::Routing::Routes.draw do |map|
+ match 'bar', :to => 'bar#index'
+ end
+ RUBY
+ end
+
+ get '/foo'
+ assert_equal 'foo', last_response.body
+
+ get '/bar'
+ assert_equal 'bar', last_response.body
+ end
+
+ test "reloads routes when configuration is changed" do
+ controller :foo, <<-RUBY
+ class FooController < ActionController::Base
+ def bar
+ render :text => "bar"
+ end
+
+ def baz
+ render :text => "baz"
+ end
+ end
+ RUBY
+
+ app_file 'config/routes.rb', <<-RUBY
+ ActionController::Routing::Routes.draw do |map|
+ match 'foo', :to => 'foo#bar'
+ end
+ RUBY
+
+ get '/foo'
+ assert_equal 'bar', last_response.body
+
+ app_file 'config/routes.rb', <<-RUBY
+ ActionController::Routing::Routes.draw do |map|
+ match 'foo', :to => 'foo#baz'
+ end
+ RUBY
+
+ get '/foo'
+ assert_equal 'baz', last_response.body
+ end
end
end