diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-05 00:38:09 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-05 00:38:09 +0000 |
commit | efe0348486aee9b19877e730a6a07db9c717f2f2 (patch) | |
tree | 7c7fd7eed5152e056b8a30bb5e9ea9b5db6a123f /actionpack/test | |
parent | f92ae75a23cddbdc6e55fc17dcf5052fba330c75 (diff) | |
download | rails-efe0348486aee9b19877e730a6a07db9c717f2f2.tar.gz rails-efe0348486aee9b19877e730a6a07db9c717f2f2.tar.bz2 rails-efe0348486aee9b19877e730a6a07db9c717f2f2.zip |
Added the possibility of passing nil to UrlHelper#link_to to use the link itself as the name
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@338 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index f4d7a689b5..382109505c 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -15,6 +15,24 @@ class FilterTest < Test::Unit::TestCase end end + class LimitedFilterController < ActionController::Base + before_filter :ensure_login, :for => :show + + def show + render_text "ran action" + end + + def show_without_filter + render_text "ran action without filter" + end + + private + def ensure_login + @ran_filter ||= [] + @ran_filter << "ensure_login" + end + end + class PrependingController < TestController prepend_before_filter :wonderful_life @@ -125,6 +143,11 @@ class FilterTest < Test::Unit::TestCase def test_running_filters_with_class assert test_process(AuditController).template.assigns["was_audited"] end + + def test_running_limited_filters + assert_equal %w( fire_flash ensure_login ), test_process(LimitedFilterController, "show").template.assigns["ran_filter"] + assert_equal %w( fire_flash ), test_process(LimitedFilterController, "show_without_filter").template.assigns["ran_filter"] + end def test_bad_filter assert_raises(ActionController::ActionControllerError) { @@ -151,9 +174,9 @@ class FilterTest < Test::Unit::TestCase end private - def test_process(controller) + def test_process(controller, action = "show") request = ActionController::TestRequest.new - request.action = "show" + request.action = action controller.process(request, ActionController::TestResponse.new) end end
\ No newline at end of file |