Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added some unit tests #706

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@775 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 11a2bb91f5153ab408ba7bd7a58948334729997b 1 parent 9a929b6
@dhh dhh authored
Showing with 36 additions and 0 deletions.
  1. +36 −0 actionpack/test/controller/filters_test.rb
View
36 actionpack/test/controller/filters_test.rb
@@ -179,6 +179,30 @@ def initialize
append_around_filter AppendedAroundFilter.new
end
+ class MixedSpecializationController < ActionController::Base
+ class OutOfOrder < StandardError; end
+
+ before_filter :first
+ before_filter :second, :only => :foo
+
+ def foo
+ render_text 'foo'
+ end
+
+ def bar
+ render_text 'bar'
+ end
+
+ protected
+ def first
+ @first = true
+ end
+
+ def second
+ raise OutOfOrder unless @first
+ end
+ end
+
def test_added_filter_to_inheritance_graph
assert_equal [ :fire_flash, :ensure_login ], TestController.before_filters
@@ -285,6 +309,18 @@ def test_rendering_breaks_filtering_chain
assert !response.template.assigns["ran_action"]
end
+ def test_filters_with_mixed_specialization_run_in_order
+ assert_nothing_raised do
+ response = test_process(MixedSpecializationController, 'bar')
+ assert_equal 'bar', response.body
+ end
+
+ assert_nothing_raised do
+ response = test_process(MixedSpecializationController, 'foo')
+ assert_equal 'foo', response.body
+ end
+ end
+
private
def test_process(controller, action = "show")
request = ActionController::TestRequest.new
Please sign in to comment.
Something went wrong with that request. Please try again.