diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2011-03-27 00:21:25 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2011-03-27 00:21:25 +0530 |
commit | 2fc32636dc07cd4986e065be2ab3fbded34cbe18 (patch) | |
tree | 7ceb3541e30d5559b0f51093f27970485d505f7e /actionpack/test/controller | |
parent | 547407a9fb375601deb0834fb1c2d9a108c9aea1 (diff) | |
parent | 7c6807296b114f0688e6e74494f1d43d3a0548ba (diff) | |
download | rails-2fc32636dc07cd4986e065be2ab3fbded34cbe18.tar.gz rails-2fc32636dc07cd4986e065be2ab3fbded34cbe18.tar.bz2 rails-2fc32636dc07cd4986e065be2ab3fbded34cbe18.zip |
Merge branch 'master' of github.com:lifo/docrails
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/filters_test.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 330fa276d0..9e44e8e088 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -505,6 +505,21 @@ class FilterTest < ActionController::TestCase end end + class ImplicitActionsController < ActionController::Base + before_filter :find_only, :only => :edit + before_filter :find_except, :except => :edit + + private + + def find_only + @only = 'Only' + end + + def find_except + @except = 'Except' + end + end + def test_sweeper_should_not_block_rendering response = test_process(SweeperTestController) assert_equal 'hello world', response.body @@ -783,6 +798,18 @@ class FilterTest < ActionController::TestCase assert_equal("I rescued this: #<FilterTest::ErrorToRescue: Something made the bad noise.>", response.body) end + def test_filters_obey_only_and_except_for_implicit_actions + test_process(ImplicitActionsController, 'show') + assert_equal 'Except', assigns(:except) + assert_nil assigns(:only) + assert_equal 'show', response.body + + test_process(ImplicitActionsController, 'edit') + assert_equal 'Only', assigns(:only) + assert_nil assigns(:except) + assert_equal 'edit', response.body + end + private def test_process(controller, action = "show") @controller = controller.is_a?(Class) ? controller.new : controller |