diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-07-07 13:45:31 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-07-07 13:45:31 +0000 |
commit | afbf54bc3dc8f9d1aeb670d927097a46e78c1515 (patch) | |
tree | 91230107cba99a907ce6aadeb1ffb62386c112c3 | |
parent | bd832a221b1c1bd09ecf446775c8d636d3783b6a (diff) | |
download | rails-afbf54bc3dc8f9d1aeb670d927097a46e78c1515.tar.gz rails-afbf54bc3dc8f9d1aeb670d927097a46e78c1515.tar.bz2 rails-afbf54bc3dc8f9d1aeb670d927097a46e78c1515.zip |
Add test for dynamic dispatch based on action_name accessor.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1757 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 21 |
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 |