jakewendt-rails_extension 2.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,606 @@
1
+ module RailsExtension::ActionControllerExtension::AccessibleViaUser
2
+
3
+ def self.included(base)
4
+ base.extend ClassMethods
5
+ base.send(:include,InstanceMethods)
6
+ end
7
+
8
+ module InstanceMethods
9
+
10
+ # This needs to be static and not dynamic or the multiple
11
+ # calls that would create it would overwrite each other.
12
+ def nawil_redirection(options={})
13
+ if options[:redirect]
14
+ send(options[:redirect])
15
+ else
16
+ root_path
17
+ end
18
+ end
19
+
20
+ end # module InstanceMethods
21
+
22
+ module ClassMethods
23
+
24
+ def awil_title(options={})
25
+ "with #{options[:login]} login#{options[:suffix]}"
26
+ end
27
+
28
+ def assert_access_with_login(*actions)
29
+ user_options = actions.extract_options!
30
+
31
+ options = {}
32
+ if ( self.constants.include?('ASSERT_ACCESS_OPTIONS') )
33
+ options.merge!(self::ASSERT_ACCESS_OPTIONS)
34
+ end
35
+ options.merge!(user_options)
36
+ actions += options[:actions]||[]
37
+
38
+ m_key = options[:model].try(:underscore).try(:to_sym)
39
+
40
+ # o = {
41
+ # :actions => {
42
+ # :new => {
43
+ # :request => [ :get, :new ]
44
+ # }
45
+ # }
46
+ # }
47
+
48
+ logins = Array(options[:logins]||options[:login])
49
+ logins.each do |login|
50
+ # options[:login] is set for the title,
51
+ # but "login_as send(login)" as options[:login]
52
+ # will be the last in the array at runtime.
53
+ options[:login] = login
54
+
55
+ test "#{brand}should get new #{awil_title(options)}" do
56
+ login_as send(login)
57
+ args = options[:new] || {}
58
+ send(:get,:new,args)
59
+ assert_response :success
60
+ assert_template 'new'
61
+ assert assigns(m_key), "#{m_key} was not assigned."
62
+ assert_nil flash[:error], "flash[:error] was not nil"
63
+ end if actions.include?(:new) || options.keys.include?(:new)
64
+
65
+ test "#{brand}should post create #{awil_title(options)}" do
66
+ login_as send(login)
67
+ args = if options[:create]
68
+ options[:create]
69
+ elsif options[:attributes_for_create]
70
+ {m_key => send(options[:attributes_for_create])}
71
+ else
72
+ {}
73
+ end
74
+ assert_difference("#{options[:model]}.count",1) do
75
+ send(:post,:create,args)
76
+ end
77
+ assert_response :redirect
78
+ assert_nil flash[:error], "flash[:error] was not nil"
79
+ end if actions.include?(:create) || options.keys.include?(:create)
80
+
81
+ test "#{brand}should NOT post create #{awil_title(options)} and #{m_key} save fails" do
82
+ login_as send(login)
83
+ # AFTER login as it may create this resource with the user
84
+ options[:model].constantize.any_instance.stubs(:create_or_update).returns(false)
85
+ args = if options[:create]
86
+ options[:create]
87
+ elsif options[:attributes_for_create]
88
+ {m_key => send(options[:attributes_for_create])}
89
+ else
90
+ {}
91
+ end
92
+ assert_difference("#{options[:model]}.count",0) do
93
+ send(:post,:create,args)
94
+ end
95
+ assert assigns(m_key)
96
+ assert_response :success
97
+ assert_template 'new'
98
+ assert_not_nil flash[:error]
99
+ end if( actions.include?(:create) || options.keys.include?(:create) ) && !options[:skip_create_failure]
100
+
101
+ test "#{brand}should NOT post create #{awil_title(options)} and invalid #{m_key}" do
102
+ login_as send(login)
103
+ # AFTER login as it may create this resource with the user
104
+ options[:model].constantize.any_instance.stubs(:valid?).returns(false)
105
+ args = if options[:create]
106
+ options[:create]
107
+ elsif options[:attributes_for_create]
108
+ {m_key => send(options[:attributes_for_create])}
109
+ else
110
+ {}
111
+ end
112
+ assert_difference("#{options[:model]}.count",0) do
113
+ send(:post,:create,args)
114
+ end
115
+ assert assigns(m_key)
116
+ assert_response :success
117
+ assert_template 'new'
118
+ assert_not_nil flash[:error]
119
+ end if( actions.include?(:create) || options.keys.include?(:create) ) && !options[:skip_create_failure]
120
+
121
+ test "#{brand}should get edit #{awil_title(options)}" do
122
+ login_as send(login)
123
+ args={}
124
+ if options[:method_for_create]
125
+ obj = send(options[:method_for_create])
126
+ args[:id] = obj.id
127
+ end
128
+ send(:get,:edit, args)
129
+ assert_response :success
130
+ assert_template 'edit'
131
+ assert assigns(m_key), "#{m_key} was not assigned."
132
+ assert_nil flash[:error], "flash[:error] was not nil"
133
+ end if actions.include?(:edit) || options.keys.include?(:edit)
134
+
135
+ test "#{brand}should NOT get edit #{awil_title(options)} and an invalid id" do
136
+ login_as send(login)
137
+ get :edit, :id => 0
138
+ assert_not_nil flash[:error], "flash[:error] was nil"
139
+ assert_response :redirect
140
+ end if( actions.include?(:edit) || options.keys.include?(:edit) ) && !options[:skip_edit_failure]
141
+
142
+ test "#{brand}should put update #{awil_title(options)}" do
143
+ login_as send(login)
144
+ args={}
145
+ if options[:method_for_create] && options[:attributes_for_create]
146
+ obj = send(options[:method_for_create])
147
+ args[:id] = obj.id
148
+ args[m_key] = send(options[:attributes_for_create])
149
+ end
150
+ before = obj.updated_at if obj
151
+ sleep 1 if obj # if updated too quickly, updated_at won't change
152
+ send(:put,:update, args)
153
+ after = obj.reload.updated_at if obj
154
+ assert_not_equal( before.to_i,after.to_i, "updated_at did not change." ) if obj
155
+ assert_response :redirect
156
+ assert_nil flash[:error], "flash[:error] was not nil"
157
+ end if actions.include?(:update) || options.keys.include?(:update)
158
+
159
+ test "#{brand}should NOT put update #{awil_title(options)} and #{m_key} save fails" do
160
+ login_as send(login)
161
+ args=options[:update]||{}
162
+ if options[:method_for_create] && options[:attributes_for_create]
163
+ obj = send(options[:method_for_create])
164
+ args[:id] = obj.id
165
+ args[m_key] = send(options[:attributes_for_create])
166
+ end
167
+ before = obj.updated_at if obj
168
+ sleep 1 if obj # if updated too quickly, updated_at won't change
169
+ options[:model].constantize.any_instance.stubs(:create_or_update).returns(false)
170
+ send(:put,:update, args)
171
+ after = obj.reload.updated_at if obj
172
+ assert_equal( before.to_s(:db), after.to_s(:db), "updated_at changed." ) if obj
173
+ assert_not_nil flash[:error], "flash[:error] was nil"
174
+ unless options[:no_redirect_check]
175
+ assert_response :success
176
+ assert_template 'edit'
177
+ end
178
+ end if( actions.include?(:update) || options.keys.include?(:update) ) && !options[:skip_update_failure]
179
+
180
+ test "#{brand}should NOT put update #{awil_title(options)} and invalid #{m_key}" do
181
+ login_as send(login)
182
+ args=options[:update]||{}
183
+ if options[:method_for_create] && options[:attributes_for_create]
184
+ obj = send(options[:method_for_create])
185
+ args[:id] = obj.id
186
+ args[m_key] = send(options[:attributes_for_create])
187
+ end
188
+ before = obj.updated_at if obj
189
+ sleep 1 if obj # if updated too quickly, updated_at won't change
190
+ options[:model].constantize.any_instance.stubs(:valid?).returns(false)
191
+ send(:put,:update, args)
192
+ after = obj.reload.updated_at if obj
193
+ assert_equal( before.to_s(:db), after.to_s(:db), "updated_at changed." ) if obj
194
+ assert_not_nil flash[:error], "flash[:error] was nil"
195
+ unless options[:no_redirect_check]
196
+ assert_response :success
197
+ assert_template 'edit'
198
+ end
199
+ end if( actions.include?(:update) || options.keys.include?(:update) ) && !options[:skip_update_failure]
200
+
201
+ test "#{brand}should NOT put update #{awil_title(options)} and an invalid id" do
202
+ login_as send(login)
203
+ put :update, :id => 0
204
+ assert_not_nil flash[:error], "flash[:error] was nil"
205
+ assert_response :redirect
206
+ end if( actions.include?(:update) || options.keys.include?(:update) ) && !options[:skip_update_failure]
207
+
208
+ test "#{brand}should get show #{awil_title(options)}" do
209
+ login_as send(login)
210
+ args={}
211
+ if options[:method_for_create]
212
+ obj = send(options[:method_for_create])
213
+ args[:id] = obj.id
214
+ end
215
+ send(:get,:show, args)
216
+ assert_response :success
217
+ assert_template 'show'
218
+ assert assigns(m_key), "#{m_key} was not assigned."
219
+ assert_nil flash[:error], "flash[:error] was not nil"
220
+ end if actions.include?(:show) || options.keys.include?(:show)
221
+
222
+ test "#{brand}should NOT get show #{awil_title(options)} and an invalid id" do
223
+ login_as send(login)
224
+ get :show, :id => 0
225
+ assert_not_nil flash[:error], "flash[:error] was nil"
226
+ assert_response :redirect
227
+ end if( actions.include?(:show) || options.keys.include?(:show) ) && !options[:skip_show_failure]
228
+
229
+ test "#{brand}should delete destroy #{awil_title(options)}" do
230
+ login_as send(login)
231
+ args={}
232
+ if options[:method_for_create]
233
+ obj = send(options[:method_for_create])
234
+ args[:id] = obj.id
235
+ end
236
+ assert_difference("#{options[:model]}.count",-1) do
237
+ send(:delete,:destroy,args)
238
+ end
239
+ assert_response :redirect
240
+ assert assigns(m_key), "#{m_key} was not assigned."
241
+ assert_nil flash[:error], "flash[:error] was not nil"
242
+ end if actions.include?(:destroy) || options.keys.include?(:destroy)
243
+
244
+ test "#{brand}should NOT delete destroy #{awil_title(options)} and an invalid id" do
245
+ login_as send(login)
246
+ delete :destroy, :id => 0
247
+ assert_not_nil flash[:error], "flash[:error] was nil"
248
+ assert_response :redirect
249
+ end if( actions.include?(:destroy) || options.keys.include?(:destroy) ) && !options[:skip_destroy_failure]
250
+
251
+ test "#{brand}should get index #{awil_title(options)}" do
252
+ login_as send(login)
253
+ get :index
254
+ assert_response :success
255
+ assert_template 'index'
256
+ assert assigns(m_key.try(:to_s).try(:pluralize).try(:to_sym)),
257
+ "#{m_key.try(:to_s).try(:pluralize).try(:to_sym)} was not assigned."
258
+ assert_nil flash[:error], "flash[:error] was not nil"
259
+ end if actions.include?(:index) || options.keys.include?(:index)
260
+
261
+ test "#{brand}should get index #{awil_title(options)} and items" do
262
+ send(options[:before]) if !options[:before].blank?
263
+ login_as send(login)
264
+ 3.times{ send(options[:method_for_create]) } if !options[:method_for_create].blank?
265
+ get :index
266
+ assert_response :success
267
+ assert_template 'index'
268
+ assert assigns(m_key.try(:to_s).try(:pluralize).try(:to_sym)),
269
+ "#{m_key.try(:to_s).try(:pluralize).try(:to_sym)} was not assigned."
270
+ assert_nil flash[:error], "flash[:error] was not nil"
271
+ end if actions.include?(:index) || options.keys.include?(:index)
272
+
273
+ end # logins.each
274
+ end
275
+
276
+
277
+ # I can't imagine a whole lot of use for this one.
278
+
279
+ def assert_access_without_login(*actions)
280
+ user_options = actions.extract_options!
281
+
282
+ options = {}
283
+ if ( self.constants.include?('ASSERT_ACCESS_OPTIONS') )
284
+ options.merge!(self::ASSERT_ACCESS_OPTIONS)
285
+ end
286
+ options.merge!(user_options)
287
+ actions += options[:actions]||[]
288
+
289
+ m_key = options[:model].try(:underscore).try(:to_sym)
290
+
291
+ test "#{brand}AWoL should get new without login" do
292
+ get :new
293
+ assert_response :success
294
+ assert_template 'new'
295
+ assert assigns(m_key), "#{m_key} was not assigned."
296
+ assert_nil flash[:error], "flash[:error] was not nil"
297
+ end if actions.include?(:new) || options.keys.include?(:new)
298
+
299
+ test "#{brand}AWoL should post create without login" do
300
+ args = if options[:create]
301
+ options[:create]
302
+ elsif options[:attributes_for_create]
303
+ {m_key => send(options[:attributes_for_create])}
304
+ else
305
+ {}
306
+ end
307
+ assert_difference("#{options[:model]}.count",1) do
308
+ send(:post,:create,args)
309
+ end
310
+ assert_response :redirect
311
+ assert_nil flash[:error], "flash[:error] was not nil"
312
+ end if actions.include?(:create) || options.keys.include?(:create)
313
+
314
+ # test "should NOT get edit without login" do
315
+ # args=[]
316
+ # if options[:factory]
317
+ # obj = Factory(options[:factory])
318
+ # args.push(:id => obj.id)
319
+ # end
320
+ # send(:get,:edit, *args)
321
+ # assert_redirected_to_login
322
+ # end if actions.include?(:edit) || options.keys.include?(:edit)
323
+ #
324
+ # test "should NOT put update without login" do
325
+ # args={}
326
+ # if options[:factory]
327
+ # obj = Factory(options[:factory])
328
+ # args[:id] = obj.id
329
+ # args[options[:factory]] = Factory.attributes_for(options[:factory])
330
+ # end
331
+ # send(:put,:update, args)
332
+ # assert_redirected_to_login
333
+ # end if actions.include?(:update) || options.keys.include?(:update)
334
+
335
+ test "#{brand}AWoL should get show without login" do
336
+ args={}
337
+ if options[:method_for_create]
338
+ obj = send(options[:method_for_create])
339
+ args[:id] = obj.id
340
+ end
341
+ send(:get,:show, args)
342
+ assert_response :success
343
+ assert_template 'show'
344
+ assert assigns(m_key), "#{m_key} was not assigned."
345
+ assert_nil flash[:error], "flash[:error] was not nil"
346
+ end if actions.include?(:show) || options.keys.include?(:show)
347
+
348
+ # test "should NOT delete destroy without login" do
349
+ # args=[]
350
+ # if options[:factory]
351
+ # obj = Factory(options[:factory])
352
+ # args.push(:id => obj.id)
353
+ # end
354
+ # assert_no_difference("#{options[:model]}.count") do
355
+ # send(:delete,:destroy,*args)
356
+ # end
357
+ # assert_redirected_to_login
358
+ # end if actions.include?(:destroy) || options.keys.include?(:destroy)
359
+ #
360
+ # test "should NOT get index without login" do
361
+ # get :index
362
+ # assert_redirected_to_login
363
+ # end if actions.include?(:index) || options.keys.include?(:index)
364
+
365
+ test "#{brand}should get index without login" do
366
+ get :index
367
+ assert_response :success
368
+ assert_template 'index'
369
+ assert assigns(m_key.try(:to_s).try(:pluralize).try(:to_sym)),
370
+ "#{m_key.try(:to_s).try(:pluralize).try(:to_sym)} was not assigned."
371
+ assert_nil flash[:error], "flash[:error] was not nil"
372
+ end if actions.include?(:index) || options.keys.include?(:index)
373
+
374
+ test "#{brand}should get index without login and items" do
375
+ send(options[:before]) if !options[:before].blank?
376
+ 3.times{ send(options[:method_for_create]) } if !options[:method_for_create].blank?
377
+ get :index
378
+ assert_response :success
379
+ assert_template 'index'
380
+ assert assigns(m_key.try(:to_s).try(:pluralize).try(:to_sym)),
381
+ "#{m_key.try(:to_s).try(:pluralize).try(:to_sym)} was not assigned."
382
+ assert_nil flash[:error], "flash[:error] was not nil"
383
+ end if actions.include?(:index) || options.keys.include?(:index)
384
+
385
+ end
386
+
387
+ def nawil_title(options={})
388
+ "with #{options[:login]} login#{options[:suffix]}"
389
+ end
390
+
391
+ def assert_no_access_with_login(*actions)
392
+ user_options = actions.extract_options!
393
+
394
+ options = {}
395
+ if ( self.constants.include?('ASSERT_ACCESS_OPTIONS') )
396
+ options.merge!(self::ASSERT_ACCESS_OPTIONS)
397
+ end
398
+ options.merge!(user_options)
399
+ actions += options[:actions]||[]
400
+
401
+ m_key = options[:model].try(:underscore).try(:to_sym)
402
+
403
+ logins = Array(options[:logins]||options[:login])
404
+ logins.each do |login|
405
+ # options[:login] is set for the title,
406
+ # but "login_as send(login)" as options[:login]
407
+ # will be the last in the array at runtime.
408
+ options[:login] = login
409
+
410
+ test "#{brand}should NOT get new #{nawil_title(options)}" do
411
+ login_as send(login)
412
+ args = options[:new]||{}
413
+ send(:get,:new,args)
414
+ assert_not_nil flash[:error], "flash[:error] was nil"
415
+ assert_response :redirect
416
+ unless options[:no_redirect_check]
417
+ assert_redirected_to nawil_redirection(options)
418
+ end
419
+ end if actions.include?(:new) || options.keys.include?(:new)
420
+
421
+ test "#{brand}should NOT post create #{nawil_title(options)}" do
422
+ login_as send(login)
423
+ args = if options[:create]
424
+ options[:create]
425
+ elsif options[:attributes_for_create]
426
+ {m_key => send(options[:attributes_for_create])}
427
+ else
428
+ {}
429
+ end
430
+ assert_no_difference("#{options[:model]}.count") do
431
+ send(:post,:create,args)
432
+ end
433
+ assert_not_nil flash[:error], "flash[:error] was nil"
434
+ assert_response :redirect
435
+ unless options[:no_redirect_check]
436
+ assert_redirected_to nawil_redirection(options)
437
+ end
438
+ end if actions.include?(:create) || options.keys.include?(:create)
439
+
440
+ test "#{brand}should NOT get edit #{nawil_title(options)}" do
441
+ login_as send(login)
442
+ args=options[:edit]||{}
443
+ if options[:method_for_create]
444
+ obj = send(options[:method_for_create])
445
+ args[:id] = obj.id
446
+ end
447
+ send(:get,:edit, args)
448
+ assert_not_nil flash[:error], "flash[:error] was nil"
449
+ assert_response :redirect
450
+ unless options[:no_redirect_check]
451
+ assert_redirected_to nawil_redirection(options)
452
+ end
453
+ end if actions.include?(:edit) || options.keys.include?(:edit)
454
+
455
+ test "#{brand}should NOT put update #{nawil_title(options)}" do
456
+ login_as send(login)
457
+ args=options[:update]||{}
458
+ if options[:method_for_create] && options[:attributes_for_create]
459
+ obj = send(options[:method_for_create])
460
+ args[:id] = obj.id
461
+ args[m_key] = send(options[:attributes_for_create])
462
+ end
463
+ before = obj.updated_at if obj
464
+ send(:put,:update, args)
465
+ after = obj.reload.updated_at if obj
466
+ assert_equal( before.to_s(:db), after.to_s(:db), "updated_at changed." ) if obj
467
+ assert_not_nil flash[:error], "flash[:error] was nil"
468
+ assert_response :redirect
469
+ unless options[:no_redirect_check]
470
+ assert_redirected_to nawil_redirection(options)
471
+ end
472
+ end if actions.include?(:update) || options.keys.include?(:update)
473
+
474
+ test "#{brand}should NOT get show #{nawil_title(options)}" do
475
+ login_as send(login)
476
+ args=options[:show]||{}
477
+ if options[:method_for_create]
478
+ obj = send(options[:method_for_create])
479
+ args[:id] = obj.id
480
+ end
481
+ send(:get,:show, args)
482
+ assert_not_nil flash[:error], "flash[:error] was nil"
483
+ assert_response :redirect
484
+ unless options[:no_redirect_check]
485
+ assert_redirected_to nawil_redirection(options)
486
+ end
487
+ end if actions.include?(:show) || options.keys.include?(:show)
488
+
489
+ test "#{brand}should NOT delete destroy #{nawil_title(options)}" do
490
+ login_as send(login)
491
+ args=options[:destroy]||{}
492
+ if options[:method_for_create]
493
+ obj = send(options[:method_for_create])
494
+ args[:id] = obj.id
495
+ end
496
+ assert_no_difference("#{options[:model]}.count") do
497
+ send(:delete,:destroy,args)
498
+ end
499
+ assert_not_nil flash[:error], "flash[:error] was nil"
500
+ assert_response :redirect
501
+ unless options[:no_redirect_check]
502
+ assert_redirected_to nawil_redirection(options)
503
+ end
504
+ end if actions.include?(:destroy) || options.keys.include?(:destroy)
505
+
506
+ test "#{brand}should NOT get index #{nawil_title(options)}" do
507
+ login_as send(login)
508
+ get :index
509
+ assert_not_nil flash[:error], "flash[:error] was nil"
510
+ assert_response :redirect
511
+ unless options[:no_redirect_check]
512
+ assert_redirected_to nawil_redirection(options)
513
+ end
514
+ end if actions.include?(:index) || options.keys.include?(:index)
515
+
516
+ end # logins.each
517
+ end
518
+
519
+ def assert_no_access_without_login(*actions)
520
+ user_options = actions.extract_options!
521
+
522
+ options = {}
523
+ if ( self.constants.include?('ASSERT_ACCESS_OPTIONS') )
524
+ options.merge!(self::ASSERT_ACCESS_OPTIONS)
525
+ end
526
+ options.merge!(user_options)
527
+ actions += options[:actions]||[]
528
+
529
+ m_key = options[:model].try(:underscore).try(:to_sym)
530
+
531
+ test "#{brand}should NOT get new without login" do
532
+ get :new
533
+ assert_redirected_to_login
534
+ end if actions.include?(:new) || options.keys.include?(:new)
535
+
536
+ test "#{brand}should NOT post create without login" do
537
+ args = if options[:create]
538
+ options[:create]
539
+ elsif options[:attributes_for_create]
540
+ {m_key => send(options[:attributes_for_create])}
541
+ else
542
+ {}
543
+ end
544
+ assert_no_difference("#{options[:model]}.count") do
545
+ send(:post,:create,args)
546
+ end
547
+ assert_redirected_to_login
548
+ end if actions.include?(:create) || options.keys.include?(:create)
549
+
550
+ test "#{brand}should NOT get edit without login" do
551
+ args={}
552
+ if options[:method_for_create]
553
+ obj = send(options[:method_for_create])
554
+ args[:id] = obj.id
555
+ end
556
+ send(:get,:edit, args)
557
+ assert_redirected_to_login
558
+ end if actions.include?(:edit) || options.keys.include?(:edit)
559
+
560
+ test "#{brand}should NOT put update without login" do
561
+ args={}
562
+ if options[:method_for_create] && options[:attributes_for_create]
563
+ obj = send(options[:method_for_create])
564
+ args[:id] = obj.id
565
+ args[m_key] = send(options[:attributes_for_create])
566
+ end
567
+ before = obj.updated_at if obj
568
+ send(:put,:update, args)
569
+ after = obj.reload.updated_at if obj
570
+ assert_equal( before.to_s(:db), after.to_s(:db) ) if obj
571
+ assert_redirected_to_login
572
+ end if actions.include?(:update) || options.keys.include?(:update)
573
+
574
+ test "#{brand}should NOT get show without login" do
575
+ args={}
576
+ if options[:method_for_create]
577
+ obj = send(options[:method_for_create])
578
+ args[:id] = obj.id
579
+ end
580
+ send(:get,:show, args)
581
+ assert_redirected_to_login
582
+ end if actions.include?(:show) || options.keys.include?(:show)
583
+
584
+ test "#{brand}should NOT delete destroy without login" do
585
+ args={}
586
+ if options[:method_for_create]
587
+ obj = send(options[:method_for_create])
588
+ args[:id] = obj.id
589
+ end
590
+ assert_no_difference("#{options[:model]}.count") do
591
+ send(:delete,:destroy,args)
592
+ end
593
+ assert_redirected_to_login
594
+ end if actions.include?(:destroy) || options.keys.include?(:destroy)
595
+
596
+ test "#{brand}should NOT get index without login" do
597
+ get :index
598
+ assert_redirected_to_login
599
+ end if actions.include?(:index) || options.keys.include?(:index)
600
+
601
+ end
602
+
603
+ end # module ClassMethods
604
+ end # module RailsExtension::ActionControllerExtension::AccessibleViaProtocol
605
+ ActionController::TestCase.send(:include,
606
+ RailsExtension::ActionControllerExtension::AccessibleViaUser)