aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/application
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2010-09-17 12:05:40 -0700
committerCarl Lerche <me@carllerche.com>2010-09-17 12:05:40 -0700
commit7418a440967586851a182bbcd6d93dbba9497cdb (patch)
tree35be90b8735b6dc7065762ca6618fedb53502e13 /railties/test/application
parentf2765a1cb3559f7c9d79d998039b6a43b5830c9f (diff)
downloadrails-7418a440967586851a182bbcd6d93dbba9497cdb.tar.gz
rails-7418a440967586851a182bbcd6d93dbba9497cdb.tar.bz2
rails-7418a440967586851a182bbcd6d93dbba9497cdb.zip
Add RouteSet#append
Allows specifying blocks to the routeset that will get appended after the RouteSet is drawn.
Diffstat (limited to 'railties/test/application')
-rw-r--r--railties/test/application/routing_test.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/railties/test/application/routing_test.rb b/railties/test/application/routing_test.rb
index bf2af11e9f..42ee4c5ebc 100644
--- a/railties/test/application/routing_test.rb
+++ b/railties/test/application/routing_test.rb
@@ -177,6 +177,34 @@ module ApplicationTests
assert_equal 'admin::foo', last_response.body
end
+ test "reloads appended route blocks" do
+ app_file 'config/routes.rb', <<-RUBY
+ AppTemplate::Application.routes.draw do
+ match ':controller#:action'
+ end
+ RUBY
+
+ add_to_config <<-R
+ routes.append do
+ match '/win' => lambda { |e| [200, {'Content-Type'=>'text/plain'}, 'WIN'] }
+ end
+ R
+
+ app 'development'
+
+ get '/win'
+ assert_equal 'WIN', last_response.body
+
+ app_file 'config/routes.rb', <<-R
+ AppTemplate::Application.routes.draw do
+ match 'lol' => 'hello#index'
+ end
+ R
+
+ get '/win'
+ assert_equal 'WIN', last_response.body
+ end
+
{"development" => "baz", "production" => "bar"}.each do |mode, expected|
test "reloads routes when configuration is changed in #{mode}" do
controller :foo, <<-RUBY