Permalink
Browse files

Procs don't call themselves

Fixes dev mode reloading [#3574 state:resolved]
  • Loading branch information...
josh committed Dec 15, 2009
1 parent a4b1927 commit f0bbc647c2086e9536c9d2b4ea7c4c18fe2edd3e
Showing with 33 additions and 1 deletion.
  1. +1 −1 railties/lib/rails/application.rb
  2. +32 −0 railties/test/application/routing_test.rb
@@ -400,7 +400,7 @@ def call(env)
reload_routes!
end
end
- ActionDispatch::Callbacks.before_dispatch { |callbacks| reload_routes }
+ ActionDispatch::Callbacks.before_dispatch { |callbacks| reload_routes.call }
end
end
@@ -119,5 +119,37 @@ def index
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

0 comments on commit f0bbc64

Please sign in to comment.