actionpack 1.13.3 → 1.13.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionpack might be problematic. Click here for more details.
- data/CHANGELOG +44 -2
- data/Rakefile +1 -1
- data/lib/action_controller/assertions/dom_assertions.rb +2 -2
- data/lib/action_controller/assertions/model_assertions.rb +1 -1
- data/lib/action_controller/assertions/response_assertions.rb +2 -0
- data/lib/action_controller/assertions/routing_assertions.rb +1 -0
- data/lib/action_controller/base.rb +7 -1
- data/lib/action_controller/caching.rb +39 -38
- data/lib/action_controller/cgi_ext/pstore_performance_fix.rb +30 -0
- data/lib/action_controller/cgi_ext/raw_post_data_fix.rb +1 -1
- data/lib/action_controller/cgi_process.rb +13 -4
- data/lib/action_controller/cookies.rb +5 -3
- data/lib/action_controller/filters.rb +176 -77
- data/lib/action_controller/integration.rb +31 -21
- data/lib/action_controller/pagination.rb +7 -1
- data/lib/action_controller/resources.rb +117 -32
- data/lib/action_controller/routing.rb +41 -1
- data/lib/action_controller/test_process.rb +5 -2
- data/lib/action_controller/url_rewriter.rb +4 -1
- data/lib/action_controller/verification.rb +1 -0
- data/lib/action_pack/version.rb +1 -1
- data/lib/action_view/base.rb +25 -19
- data/lib/action_view/compiled_templates.rb +2 -2
- data/lib/action_view/helpers/active_record_helper.rb +18 -18
- data/lib/action_view/helpers/debug_helper.rb +10 -0
- data/lib/action_view/helpers/deprecated_helper.rb +3 -0
- data/lib/action_view/helpers/prototype_helper.rb +33 -17
- data/test/activerecord/pagination_test.rb +9 -0
- data/test/controller/addresses_render_test.rb +4 -1
- data/test/controller/base_test.rb +1 -1
- data/test/controller/caching_test.rb +3 -2
- data/test/controller/cookie_test.rb +11 -0
- data/test/controller/deprecation/deprecated_base_methods_test.rb +18 -0
- data/test/controller/filter_params_test.rb +1 -0
- data/test/controller/filters_test.rb +149 -26
- data/test/controller/integration_test.rb +93 -8
- data/test/controller/resources_test.rb +215 -36
- data/test/controller/routing_test.rb +1 -1
- data/test/controller/test_test.rb +16 -0
- data/test/controller/url_rewriter_test.rb +13 -1
- data/test/controller/verification_test.rb +15 -0
- data/test/fixtures/test/hello_world.rxml +2 -1
- data/test/template/asset_tag_helper_test.rb +5 -0
- data/test/template/compiled_templates_test.rb +29 -17
- data/test/template/number_helper_test.rb +1 -1
- data/test/template/prototype_helper_test.rb +2 -2
- metadata +84 -83
@@ -39,7 +39,10 @@ class AddressesTest < Test::Unit::TestCase
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_list
|
42
|
-
|
42
|
+
# because pagination is deprecated
|
43
|
+
ActiveSupport::Deprecation.silence do
|
44
|
+
get :list
|
45
|
+
end
|
43
46
|
assert_equal "We only need to get this far!", @response.body.chomp
|
44
47
|
end
|
45
48
|
end
|
@@ -88,7 +88,7 @@ class ControllerInstanceTests < Test::Unit::TestCase
|
|
88
88
|
# Mocha adds methods to Object which are then included in the public_instance_methods
|
89
89
|
# This method hides those from the controller so the above tests won't know the difference
|
90
90
|
def hide_mocha_methods_from_controller(controller)
|
91
|
-
mocha_methods = [:expects, :metaclass, :mocha, :mocha_inspect, :reset_mocha, :stubba_object, :stubba_method, :stubs, :verify]
|
91
|
+
mocha_methods = [:expects, :metaclass, :mocha, :mocha_inspect, :reset_mocha, :stubba_object, :stubba_method, :stubs, :verify, :__is_a__, :__metaclass__]
|
92
92
|
controller.class.send(:hide_action, *mocha_methods)
|
93
93
|
end
|
94
94
|
|
@@ -97,6 +97,7 @@ class ActionCachingTestController < ActionController::Base
|
|
97
97
|
caches_action :index
|
98
98
|
|
99
99
|
def index
|
100
|
+
sleep 0.01
|
100
101
|
@cache_this = Time.now.to_f.to_s
|
101
102
|
render :text => @cache_this
|
102
103
|
end
|
@@ -195,7 +196,7 @@ class ActionCacheTest < Test::Unit::TestCase
|
|
195
196
|
def test_xml_version_of_resource_is_treated_as_different_cache
|
196
197
|
@mock_controller.mock_url_for = 'http://example.org/posts/'
|
197
198
|
@mock_controller.mock_path = '/posts/index.xml'
|
198
|
-
path_object = @path_class.new(@mock_controller)
|
199
|
+
path_object = @path_class.new(@mock_controller, {})
|
199
200
|
assert_equal 'xml', path_object.extension
|
200
201
|
assert_equal 'example.org/posts/index.xml', path_object.path
|
201
202
|
end
|
@@ -204,7 +205,7 @@ class ActionCacheTest < Test::Unit::TestCase
|
|
204
205
|
@mock_controller.mock_url_for = 'http://example.org/'
|
205
206
|
@mock_controller.mock_path = '/'
|
206
207
|
|
207
|
-
assert_equal 'example.org/index', @path_class.path_for(@mock_controller)
|
208
|
+
assert_equal 'example.org/index', @path_class.path_for(@mock_controller, {})
|
208
209
|
end
|
209
210
|
|
210
211
|
def test_file_extensions
|
@@ -31,6 +31,11 @@ class CookieTest < Test::Unit::TestCase
|
|
31
31
|
cookies.delete("user_name")
|
32
32
|
end
|
33
33
|
|
34
|
+
def delete_cookie_with_path
|
35
|
+
cookies.delete("user_name", :path => '/beaten')
|
36
|
+
render_text "hello world"
|
37
|
+
end
|
38
|
+
|
34
39
|
def rescue_action(e)
|
35
40
|
raise unless ActionController::MissingTemplate # No templates here, and we don't care about the output
|
36
41
|
end
|
@@ -85,4 +90,10 @@ class CookieTest < Test::Unit::TestCase
|
|
85
90
|
assert_equal "david", jar["user_name"]
|
86
91
|
assert_equal nil, jar["something_else"]
|
87
92
|
end
|
93
|
+
|
94
|
+
def test_delete_cookie_with_path
|
95
|
+
get :delete_cookie_with_path
|
96
|
+
assert_equal "/beaten", @response.headers["cookie"].first.path
|
97
|
+
assert_not_equal "/", @response.headers["cookie"].first.path
|
98
|
+
end
|
88
99
|
end
|
@@ -1,6 +1,12 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../abstract_unit'
|
2
2
|
|
3
3
|
class DeprecatedBaseMethodsTest < Test::Unit::TestCase
|
4
|
+
# ActiveRecord model mock to test pagination deprecation
|
5
|
+
class DummyModel
|
6
|
+
def self.find(*args) [] end
|
7
|
+
def self.count(*args) 0 end
|
8
|
+
end
|
9
|
+
|
4
10
|
class Target < ActionController::Base
|
5
11
|
def deprecated_symbol_parameter_to_url_for
|
6
12
|
redirect_to(url_for(:home_url, "superstars"))
|
@@ -18,6 +24,11 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase
|
|
18
24
|
this_method_doesnt_exist
|
19
25
|
end
|
20
26
|
|
27
|
+
def pagination
|
28
|
+
paginate :dummy_models, :class_name => 'DeprecatedBaseMethodsTest::DummyModel'
|
29
|
+
render :nothing => true
|
30
|
+
end
|
31
|
+
|
21
32
|
def rescue_action(e) raise e end
|
22
33
|
end
|
23
34
|
|
@@ -27,6 +38,7 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase
|
|
27
38
|
@request = ActionController::TestRequest.new
|
28
39
|
@response = ActionController::TestResponse.new
|
29
40
|
@controller = Target.new
|
41
|
+
@controller.logger = Logger.new(nil) unless @controller.logger
|
30
42
|
end
|
31
43
|
|
32
44
|
def test_deprecated_symbol_parameter_to_url_for
|
@@ -57,4 +69,10 @@ class DeprecatedBaseMethodsTest < Test::Unit::TestCase
|
|
57
69
|
error = Test::Unit::Error.new('testing ur doodz', e)
|
58
70
|
assert_not_deprecated { error.message }
|
59
71
|
end
|
72
|
+
|
73
|
+
def test_pagination_deprecation
|
74
|
+
assert_deprecated('svn://errtheblog.com/svn/plugins/classic_pagination') do
|
75
|
+
get :pagination
|
76
|
+
end
|
77
|
+
end
|
60
78
|
end
|
@@ -16,6 +16,7 @@ class FilterParamTest < Test::Unit::TestCase
|
|
16
16
|
assert @controller.respond_to?(:filter_parameters)
|
17
17
|
|
18
18
|
test_hashes = [[{},{},[]],
|
19
|
+
[{'foo'=>nil},{'foo'=>nil},[]],
|
19
20
|
[{'foo'=>'bar'},{'foo'=>'bar'},[]],
|
20
21
|
[{'foo'=>'bar'},{'foo'=>'bar'},%w'food'],
|
21
22
|
[{'foo'=>'bar'},{'foo'=>'[FILTERED]'},%w'foo'],
|
@@ -14,7 +14,7 @@ class FilterTest < Test::Unit::TestCase
|
|
14
14
|
@ran_filter ||= []
|
15
15
|
@ran_filter << "ensure_login"
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def clean_up
|
19
19
|
@ran_after_filter ||= []
|
20
20
|
@ran_after_filter << "clean_up"
|
@@ -62,7 +62,7 @@ class FilterTest < Test::Unit::TestCase
|
|
62
62
|
render :inline => "something else"
|
63
63
|
end
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
class ConditionalFilterController < ActionController::Base
|
67
67
|
def show
|
68
68
|
render :inline => "ran action"
|
@@ -86,7 +86,7 @@ class FilterTest < Test::Unit::TestCase
|
|
86
86
|
@ran_filter ||= []
|
87
87
|
@ran_filter << "clean_up_tmp"
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
def rescue_action(e) raise(e) end
|
91
91
|
end
|
92
92
|
|
@@ -94,7 +94,7 @@ class FilterTest < Test::Unit::TestCase
|
|
94
94
|
before_filter :ensure_login, :except => [ :show_without_filter, :another_action ]
|
95
95
|
end
|
96
96
|
|
97
|
-
class OnlyConditionSymController < ConditionalFilterController
|
97
|
+
class OnlyConditionSymController < ConditionalFilterController
|
98
98
|
before_filter :ensure_login, :only => :show
|
99
99
|
end
|
100
100
|
|
@@ -104,10 +104,10 @@ class FilterTest < Test::Unit::TestCase
|
|
104
104
|
|
105
105
|
class BeforeAndAfterConditionController < ConditionalFilterController
|
106
106
|
before_filter :ensure_login, :only => :show
|
107
|
-
after_filter :clean_up_tmp, :only => :show
|
107
|
+
after_filter :clean_up_tmp, :only => :show
|
108
108
|
end
|
109
|
-
|
110
|
-
class OnlyConditionProcController < ConditionalFilterController
|
109
|
+
|
110
|
+
class OnlyConditionProcController < ConditionalFilterController
|
111
111
|
before_filter(:only => :show) {|c| c.assigns["ran_proc_filter"] = true }
|
112
112
|
end
|
113
113
|
|
@@ -131,6 +131,14 @@ class FilterTest < Test::Unit::TestCase
|
|
131
131
|
before_filter(ConditionalClassFilter, :ensure_login, Proc.new {|c| c.assigns["ran_proc_filter1"] = true }, :except => :show_without_filter) { |c| c.assigns["ran_proc_filter2"] = true}
|
132
132
|
end
|
133
133
|
|
134
|
+
class EmptyFilterChainController < TestController
|
135
|
+
self.filter_chain.clear
|
136
|
+
def show
|
137
|
+
@action_executed = true
|
138
|
+
render :text => "yawp!"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
134
142
|
class PrependingController < TestController
|
135
143
|
prepend_before_filter :wonderful_life
|
136
144
|
# skip_before_filter :fire_flash
|
@@ -145,7 +153,7 @@ class FilterTest < Test::Unit::TestCase
|
|
145
153
|
class ConditionalSkippingController < TestController
|
146
154
|
skip_before_filter :ensure_login, :only => [ :login ]
|
147
155
|
skip_after_filter :clean_up, :only => [ :login ]
|
148
|
-
|
156
|
+
|
149
157
|
before_filter :find_user, :only => [ :change_password ]
|
150
158
|
|
151
159
|
def login
|
@@ -155,7 +163,7 @@ class FilterTest < Test::Unit::TestCase
|
|
155
163
|
def change_password
|
156
164
|
render :inline => "ran action"
|
157
165
|
end
|
158
|
-
|
166
|
+
|
159
167
|
protected
|
160
168
|
def find_user
|
161
169
|
@ran_filter ||= []
|
@@ -166,15 +174,15 @@ class FilterTest < Test::Unit::TestCase
|
|
166
174
|
class ConditionalParentOfConditionalSkippingController < ConditionalFilterController
|
167
175
|
before_filter :conditional_in_parent, :only => [:show, :another_action]
|
168
176
|
after_filter :conditional_in_parent, :only => [:show, :another_action]
|
169
|
-
|
177
|
+
|
170
178
|
private
|
171
|
-
|
179
|
+
|
172
180
|
def conditional_in_parent
|
173
181
|
@ran_filter ||= []
|
174
182
|
@ran_filter << 'conditional_in_parent'
|
175
183
|
end
|
176
184
|
end
|
177
|
-
|
185
|
+
|
178
186
|
class ChildOfConditionalParentController < ConditionalParentOfConditionalSkippingController
|
179
187
|
skip_before_filter :conditional_in_parent, :only => :another_action
|
180
188
|
skip_after_filter :conditional_in_parent, :only => :another_action
|
@@ -197,7 +205,7 @@ class FilterTest < Test::Unit::TestCase
|
|
197
205
|
controller.assigns["was_audited"] = true
|
198
206
|
end
|
199
207
|
end
|
200
|
-
|
208
|
+
|
201
209
|
class AroundFilter
|
202
210
|
def before(controller)
|
203
211
|
@execution_log = "before"
|
@@ -209,7 +217,7 @@ class FilterTest < Test::Unit::TestCase
|
|
209
217
|
controller.assigns["execution_log"] = @execution_log + " and after"
|
210
218
|
controller.assigns["after_ran"] = true
|
211
219
|
controller.class.execution_log << " after aroundfilter " if controller.respond_to? :execution_log
|
212
|
-
end
|
220
|
+
end
|
213
221
|
end
|
214
222
|
|
215
223
|
class AppendedAroundFilter
|
@@ -219,12 +227,12 @@ class FilterTest < Test::Unit::TestCase
|
|
219
227
|
|
220
228
|
def after(controller)
|
221
229
|
controller.class.execution_log << " after appended aroundfilter "
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
225
233
|
class AuditController < ActionController::Base
|
226
234
|
before_filter(AuditFilter)
|
227
|
-
|
235
|
+
|
228
236
|
def show
|
229
237
|
render_text "hello"
|
230
238
|
end
|
@@ -234,6 +242,14 @@ class FilterTest < Test::Unit::TestCase
|
|
234
242
|
around_filter AroundFilter.new
|
235
243
|
end
|
236
244
|
|
245
|
+
class BeforeAfterClassFilterController < PrependingController
|
246
|
+
begin
|
247
|
+
filter = AroundFilter.new
|
248
|
+
before_filter filter
|
249
|
+
after_filter filter
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
237
253
|
class MixedFilterController < PrependingController
|
238
254
|
cattr_accessor :execution_log
|
239
255
|
|
@@ -247,7 +263,7 @@ class FilterTest < Test::Unit::TestCase
|
|
247
263
|
after_filter { |c| c.class.execution_log << " after procfilter " }
|
248
264
|
append_around_filter AppendedAroundFilter.new
|
249
265
|
end
|
250
|
-
|
266
|
+
|
251
267
|
class MixedSpecializationController < ActionController::Base
|
252
268
|
class OutOfOrder < StandardError; end
|
253
269
|
|
@@ -285,6 +301,101 @@ class FilterTest < Test::Unit::TestCase
|
|
285
301
|
end
|
286
302
|
end
|
287
303
|
|
304
|
+
class PrependingBeforeAndAfterController < ActionController::Base
|
305
|
+
prepend_before_filter :before_all
|
306
|
+
prepend_after_filter :after_all
|
307
|
+
before_filter :between_before_all_and_after_all
|
308
|
+
|
309
|
+
def before_all
|
310
|
+
@ran_filter ||= []
|
311
|
+
@ran_filter << 'before_all'
|
312
|
+
end
|
313
|
+
|
314
|
+
def after_all
|
315
|
+
@ran_filter ||= []
|
316
|
+
@ran_filter << 'after_all'
|
317
|
+
end
|
318
|
+
|
319
|
+
def between_before_all_and_after_all
|
320
|
+
@ran_filter ||= []
|
321
|
+
@ran_filter << 'between_before_all_and_after_all'
|
322
|
+
end
|
323
|
+
def show
|
324
|
+
render :text => 'hello'
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
class NonYieldingAroundFilterController < ActionController::Base
|
329
|
+
|
330
|
+
before_filter :filter_one
|
331
|
+
around_filter :non_yielding_filter
|
332
|
+
before_filter :filter_two
|
333
|
+
after_filter :filter_three
|
334
|
+
|
335
|
+
def index
|
336
|
+
render :inline => "index"
|
337
|
+
end
|
338
|
+
|
339
|
+
#make sure the controller complains
|
340
|
+
def rescue_action(e); raise e; end
|
341
|
+
|
342
|
+
private
|
343
|
+
|
344
|
+
def filter_one
|
345
|
+
@filters ||= []
|
346
|
+
@filters << "filter_one"
|
347
|
+
end
|
348
|
+
|
349
|
+
def filter_two
|
350
|
+
@filters << "filter_two"
|
351
|
+
end
|
352
|
+
|
353
|
+
def non_yielding_filter
|
354
|
+
@filters << "zomg it didn't yield"
|
355
|
+
@filter_return_value
|
356
|
+
end
|
357
|
+
|
358
|
+
def filter_three
|
359
|
+
@filters << "filter_three"
|
360
|
+
end
|
361
|
+
|
362
|
+
end
|
363
|
+
|
364
|
+
def test_non_yielding_around_filters_not_returning_false_do_not_raise
|
365
|
+
controller = NonYieldingAroundFilterController.new
|
366
|
+
controller.instance_variable_set "@filter_return_value", true
|
367
|
+
assert_nothing_raised do
|
368
|
+
test_process(controller, "index")
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
def test_non_yielding_around_filters_returning_false_do_not_raise
|
373
|
+
controller = NonYieldingAroundFilterController.new
|
374
|
+
controller.instance_variable_set "@filter_return_value", false
|
375
|
+
assert_nothing_raised do
|
376
|
+
test_process(controller, "index")
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
def test_after_filters_are_not_run_if_around_filter_returns_false
|
381
|
+
controller = NonYieldingAroundFilterController.new
|
382
|
+
controller.instance_variable_set "@filter_return_value", false
|
383
|
+
test_process(controller, "index")
|
384
|
+
assert_equal ["filter_one", "zomg it didn't yield"], controller.assigns['filters']
|
385
|
+
end
|
386
|
+
|
387
|
+
def test_after_filters_are_not_run_if_around_filter_does_not_yield
|
388
|
+
controller = NonYieldingAroundFilterController.new
|
389
|
+
controller.instance_variable_set "@filter_return_value", true
|
390
|
+
test_process(controller, "index")
|
391
|
+
assert_equal ["filter_one", "zomg it didn't yield"], controller.assigns['filters']
|
392
|
+
end
|
393
|
+
|
394
|
+
def test_empty_filter_chain
|
395
|
+
assert_equal 0, EmptyFilterChainController.filter_chain.size
|
396
|
+
assert test_process(EmptyFilterChainController).template.assigns['action_executed']
|
397
|
+
end
|
398
|
+
|
288
399
|
def test_added_filter_to_inheritance_graph
|
289
400
|
assert_equal [ :ensure_login ], TestController.before_filters
|
290
401
|
end
|
@@ -292,11 +403,11 @@ class FilterTest < Test::Unit::TestCase
|
|
292
403
|
def test_base_class_in_isolation
|
293
404
|
assert_equal [ ], ActionController::Base.before_filters
|
294
405
|
end
|
295
|
-
|
406
|
+
|
296
407
|
def test_prepending_filter
|
297
408
|
assert_equal [ :wonderful_life, :ensure_login ], PrependingController.before_filters
|
298
409
|
end
|
299
|
-
|
410
|
+
|
300
411
|
def test_running_filters
|
301
412
|
assert_equal %w( wonderful_life ensure_login ), test_process(PrependingController).template.assigns["ran_filter"]
|
302
413
|
end
|
@@ -304,11 +415,11 @@ class FilterTest < Test::Unit::TestCase
|
|
304
415
|
def test_running_filters_with_proc
|
305
416
|
assert test_process(ProcController).template.assigns["ran_proc_filter"]
|
306
417
|
end
|
307
|
-
|
418
|
+
|
308
419
|
def test_running_filters_with_implicit_proc
|
309
420
|
assert test_process(ImplicitProcController).template.assigns["ran_proc_filter"]
|
310
421
|
end
|
311
|
-
|
422
|
+
|
312
423
|
def test_running_filters_with_class
|
313
424
|
assert test_process(AuditController).template.assigns["was_audited"]
|
314
425
|
end
|
@@ -319,7 +430,7 @@ class FilterTest < Test::Unit::TestCase
|
|
319
430
|
assert response.template.assigns["ran_class_filter"]
|
320
431
|
assert response.template.assigns["ran_proc_filter1"]
|
321
432
|
assert response.template.assigns["ran_proc_filter2"]
|
322
|
-
|
433
|
+
|
323
434
|
response = test_process(AnomolousYetValidConditionController, "show_without_filter")
|
324
435
|
assert_equal nil, response.template.assigns["ran_filter"]
|
325
436
|
assert !response.template.assigns["ran_class_filter"]
|
@@ -373,6 +484,12 @@ class FilterTest < Test::Unit::TestCase
|
|
373
484
|
assert controller.template.assigns["after_ran"]
|
374
485
|
end
|
375
486
|
|
487
|
+
def test_before_after_class_filter
|
488
|
+
controller = test_process(BeforeAfterClassFilterController)
|
489
|
+
assert controller.template.assigns["before_ran"]
|
490
|
+
assert controller.template.assigns["after_ran"]
|
491
|
+
end
|
492
|
+
|
376
493
|
def test_having_properties_in_around_filter
|
377
494
|
controller = test_process(AroundFilterController)
|
378
495
|
assert_equal "before and after", controller.template.assigns["execution_log"]
|
@@ -381,10 +498,10 @@ class FilterTest < Test::Unit::TestCase
|
|
381
498
|
def test_prepending_and_appending_around_filter
|
382
499
|
controller = test_process(MixedFilterController)
|
383
500
|
assert_equal " before aroundfilter before procfilter before appended aroundfilter " +
|
384
|
-
" after appended aroundfilter after aroundfilter after procfilter ",
|
501
|
+
" after appended aroundfilter after aroundfilter after procfilter ",
|
385
502
|
MixedFilterController.execution_log
|
386
503
|
end
|
387
|
-
|
504
|
+
|
388
505
|
def test_rendering_breaks_filtering_chain
|
389
506
|
response = test_process(RenderingController)
|
390
507
|
assert_equal "something else", response.body
|
@@ -412,6 +529,12 @@ class FilterTest < Test::Unit::TestCase
|
|
412
529
|
end
|
413
530
|
end
|
414
531
|
|
532
|
+
def test_running_prepended_before_and_after_filter
|
533
|
+
assert_equal 3, PrependingBeforeAndAfterController.filter_chain.length
|
534
|
+
response = test_process(PrependingBeforeAndAfterController)
|
535
|
+
assert_equal %w( before_all between_before_all_and_after_all after_all ), response.template.assigns["ran_filter"]
|
536
|
+
end
|
537
|
+
|
415
538
|
def test_conditional_skipping_of_filters
|
416
539
|
assert_nil test_process(ConditionalSkippingController, "login").template.assigns["ran_filter"]
|
417
540
|
assert_equal %w( ensure_login find_user ), test_process(ConditionalSkippingController, "change_password").template.assigns["ran_filter"]
|