aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/controller/filters_test.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb
index af14385fe3..5480843e22 100644
--- a/actionpack/test/controller/filters_test.rb
+++ b/actionpack/test/controller/filters_test.rb
@@ -203,6 +203,18 @@ class FilterTest < Test::Unit::TestCase
end
end
+ class DynamicDispatchController < ActionController::Base
+ before_filter :choose
+
+ %w(foo bar baz).each do |action|
+ define_method(action) { render :text => action }
+ end
+
+ private
+ def choose
+ self.action_name = params[:choose]
+ end
+ end
def test_added_filter_to_inheritance_graph
assert_equal [ :fire_flash, :ensure_login ], TestController.before_filters
@@ -321,6 +333,15 @@ class FilterTest < Test::Unit::TestCase
end
end
+ def test_dynamic_dispatch
+ %w(foo bar baz).each do |action|
+ request = ActionController::TestRequest.new
+ request.query_parameters[:choose] = action
+ response = DynamicDispatchController.process(request, ActionController::TestResponse.new)
+ assert_equal action, response.body
+ end
+ end
+
private
def test_process(controller, action = "show")
request = ActionController::TestRequest.new