Procs don't call themselves

Fixes dev mode reloading [#3574 state:resolved]
This commit is contained in:
Joshua Peek
2009-12-15 10:48:56 -06:00
parent a4b19277b2
commit f0bbc647c2
2 changed files with 33 additions and 1 deletions

View File

@@ -400,7 +400,7 @@ module Rails
reload_routes!
end
end
ActionDispatch::Callbacks.before_dispatch { |callbacks| reload_routes }
ActionDispatch::Callbacks.before_dispatch { |callbacks| reload_routes.call }
end
end

View File

@@ -119,5 +119,37 @@ module ApplicationTests
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